fork download
  1. import re
  2.  
  3. string = '''No Mon Date Time Values colors
  4. 1 Nov 11-03-2016 23:17:52 Red colors
  5. 2 Nov 11-03-2016 19:18:00 Yellow colors
  6. 3 Nov 11-03-2016 19:18:18 Blue colors
  7. 4 Oct 10-03-2016 19:22:58 Orange Green colors
  8. 5 Oct 10-07-2016 10:37:36 Red Blue Yellow colors
  9. 6 Oct 10-07-2016 10:37:36 White colors
  10. 7 Sep 09-07-2016 10:37:37 Ping White Yellow Green colors'''
  11.  
  12. for i in string.splitlines():
  13. arr = re.split(r'\s+', i, 4)
  14. print('{:3} | {:3} | {:10} | {:10} | {:23}|'.
  15. format(arr[0], arr[1], arr[2], arr[3], re.split(r'\s{2,}', arr[4])[0]))
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
No  | Mon | Date       | Time       | Values                 |
1   | Nov | 11-03-2016 | 23:17:52   | Red                    |
2   | Nov | 11-03-2016 | 19:18:00   | Yellow                 |
3   | Nov | 11-03-2016 | 19:18:18   | Blue                   |
4   | Oct | 10-03-2016 | 19:22:58   | Orange Green           |
5   | Oct | 10-07-2016 | 10:37:36   | Red Blue Yellow        |
6   | Oct | 10-07-2016 | 10:37:36   | White                  |
7   | Sep | 09-07-2016 | 10:37:37   | Ping White Yellow Green|