[Tutor] Question

Que Prime queprime at gmail.com
Thu Jul 12 22:19:56 CEST 2007


I'm trying to create a program that creates a file and write the number for
each line.  Here is what I have so far but can't seem to get the loop and
write correct.

Thanks in advance.


print "Creating txt file"
tfile = open("25.txt", "w")

for i in range(25):
    x = int(1)
    tfile.writelines("x\n")
    x += 1

tfile.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070712/ee215152/attachment.html 


More information about the Tutor mailing list