fork download
  1. #!/usr/bin/env python
  2. import fileinput
  3.  
  4. width = 6
  5. for line in fileinput.input():
  6. station_id, year, s = line.split(None, 2)
  7. s = s.rstrip('\n').rjust(12 * width)
  8. temps = [s[i:i+width].strip() for i in range(0, len(s), width)]
  9. print(temps)
Success #stdin #stdout 0s 23352KB
stdin
20046 2005  27.0  44.3   9.0  15.9   3.6   9.2   9.2  37.5  18.3  18.6  24.4  26.0
20667 2014   5.5   2.4   7.9   8.1              42.7              10.1            
stdout
['27.0', '44.3', '9.0', '15.9', '3.6', '9.2', '9.2', '37.5', '18.3', '18.6', '24.4', '26.0']
['5.5', '2.4', '7.9', '8.1', '', '', '42.7', '', '', '10.1', '', '']