全部博文(362)
分类: Python/Ruby
2009-10-29 16:16:02
'maketextfile.py --- create text file'
import os
ls = os.linesep
# get filename
while True:
# get file content (text) lines
all=[]
print"\nEnter lines ('.'by itselef to quit).\n"
# loop until user terminates input
while True:
# write lines to file with proper line-ending
fobj = open(r'C:\Python26\make.log','w')
fobj.writelines(['%s%s' % (x,ls) for x in all])
fobj.close()
print 'DONE!'