David wrote: > #!/usr/bin/python > import tarfile > tFile = tarfile.open("/home/david/zip_files/zip.tar.gz", "r") > for f in tFile.getnames(): > print f > tFile.close() > #fname = "out.txt" > #fobj = open(fname, 'w') > #for line in f: > # fobj.write(line + '/n') > #tFile.close() > #fobj.close() > > My problem is I can not figure out how to write to the file with new > lines, as you can see my attempts at the bottom. This works fine in Linux; > ./py_list_zip.py >> out.txt > > but I want to learn how to do it within python, plus to understand. > > any hints :) > > thanks > -david > > > oops should have been; fobj.write(line + '\n') still does not work, now here is the output from the print statment; zip/ zip/py_database.py zip/print_time.py and out.txt z i p / p r i n t _ t i m e . p y
-- Powered by Gentoo GNU/LINUX http://www.linuxcrazy.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor