FileIO problem

2005-08-23 Thread Layin'_Low
i'm havin a problem with this simple program. i need the output of this
loop to be written to a file but i dont know how to do it!! this is
what i have right now:

gclas = raw_input("What is the class:")
count = 0
while count != 1000:
count = count + 1
print "Admin forceclass " , count , gclas

i know the IO script. i tried calling it a function, but i got an error
that says  i cant call funtions for writing:

gclas = raw_input("What is the class:")
def Princlas():
count = 0
while count != 1000:
count = count + 1
print "Admin forceclass " , 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?Any solution or
help i s more that welcome

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FileIO problem

2005-08-24 Thread Layin'_Low
thnx guys it was late and had just come from a bar and didnt reread the
lines. thnx again for the help

-- 
http://mail.python.org/mailman/listinfo/python-list