I have a list of unknown number of items, let\'s say 26. let\'s say
list=[\'a\',\'b\',\'c\',\'d\',\'e\',\'f\',\'g\',\'h\', \'i\',\'j\',\'k\',\'l\',\'m\',\'n\',\'
start = 0 for item in list: if start < 4: thefile.write("%s" % item) start = start + 1 else: #once the program wrote 4 items, write the 5th item and two linebreaks thefile.write("%s\n\n" % item) start = 0