Script Generation, help!

F. GEIGER f.geiger at vol.at
Fri Nov 5 02:25:32 EST 2004


A sketch of a solution could be (untested):

yourText = "%s=(%d)" % (yourString, yourNumber)
try:
   f = open(yourFileName, "wt")
   f.write(yourText + "\n")
   f.close()
except IOError, e:
   print "There's a problem writing to file %s: %s" % (yourFileName, e)

Creating strings and numbers and putting that and the write into a loop is
yours ;-)

Kind regards
Franz GEIGER

"digital_ant2" <digital_ant2 at yahoo.com> schrieb im Newsbeitrag
news:mailman.5952.1099638388.5135.python-list at python.org...
>
> I'm new to python, so I'll be at detailed as I can be.
>
> I need to generate a script where each line is like this:
>
> Spam=(x)
> Spam=(y)
> Spam=(z)
>
> each entry being on their own line, Spam is a string of text and
> x,y,and z are random numbers, I also need it to be exported to a text
> file with a specified extension.... being completely NEW to python I
> push in the right direction would be really helpfull!
>
> Thanks,
> Pat
>
>
>
>





More information about the Python-list mailing list