jrlen balane said unto the world upon 2005-03-13 19:37:
so for example, i am creating a text file with file.write()

how am i going to make the file a tab-delimited file??? any
parameters needed???


>>> record1 = ['Foo', 'Bar', 'Baz'] >>> record2 = ['Ham', 'Spam', 'Eggs'] >>> records = [record1, record2] >>> lines = [] >>> for record in records: ... lines.append('\t'.join(record) + '\n') ... >>> lines ['Foo\tBar\tBaz\n', 'Ham\tSpam\tEggs\n'] >>> output_file = file('c:/output.txt', 'w') >>> output_file.writelines(lines) >>> output_file.close() >>>

HTH,

Brian vdB

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to