FileIO problem
Laszlo Zsolt Nagy
gandalf at geochemsource.com
Wed Aug 24 03:12:56 EDT 2005
Try this:
gclas = raw_input("What is the class:")
def Princlas():
count = 0
while count != 1000:
count = count + 1
return "Admin forceclass %s %s " % ( count , gclas )
#asks for file name
a = raw_input("What is new file name:")
out_file = open(a,"w")
#this is the input of text
out_file.write(Princlas())
out_file.close()
>i know i need to get it to a string but i dont know how?
>
Your functions should RETURN a string, with the "return" statement.
Another issue: you cannot write the function itself, only its result:
out_file.write(Princlas())
instead of
out_file.write(Princlas)
More information about the Python-list
mailing list