[Tutor] lists and strings
ajikoe at gmail.com
Tue Nov 8 20:17:52 CET 2005
yes it is...
convert list to string:
L = [1,2,3]
L = [str(x) for x in L]
s = string.join(L,' ')
convert list to a file
myF = open(namaFile,"w")
for s in myList[:-1]:
On 11/8/05, Mike Haft <m.haft at abdn.ac.uk> wrote:
> 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?
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor