"Write to a file" question please?

Wim Lavrijsen wlav at hpatl26.cern.ch
Wed Jul 5 09:43:38 EDT 2000


cmfinlay at SPAMmagnet.com.au writes:

>number = 100
>print "Number =", number
>OUT = open("TT.txt","w")
>OUT.write("Number =", number) # Error

'write' expects only 1 argument. You should build a string to
hand to write. Something like:

OUT.write( 'Number = %d' % number + '\n' ) 

Best regards,
      Wim Lavrijsen



More information about the Python-list mailing list