I currently have a list stored in a variable for example:
- 01/01/2015
- 13:22
- Steak
- 01/02/2015
- 13:23
- Fries
- 01/03/2015
- 13:23
- Salad
I have a variable z that holds this information.
I want to join every 3 lines together so the output is date + time + order in one line. I tried the below but this puts 3 letters on each line rather than the 3 lines
threelines = range(0,len(z),3)
for num, line in enumerate(z):
if num in threelines:
print ' '.join(z[num:num+3])
Any help would be appreciated!