yes it is...
 
convert list to string:
    L = [1,2,3]
    L = [str(x) for x in L]
    s = string.join(L,' ')
    print len(s)
 
convert list to a file
    myF = open(namaFile,"w")
    for s in myList[:-1]:
        myF.write(str(s)+"\n")
    myF.write(str(myList[len(myList)-1]))
    myF.close()
 
 
Cheers,
pujo

 
On 11/8/05, Mike Haft <[EMAIL PROTECTED]> wrote:
Hello,
    I've been working on a problem and have now sorted most of it (thanks
to some help from the list).

All the ways of writing data to a file I know keep telling me that lists
can't be written to the file. I'm trying to convert data from one set of
files into files of a different format. But the easiest way to get the
data from the first set of files is in a list(s).

So, is there any way to convert lists to strings? Or a way to write lists
to a file?

Thanks

Mike

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to