list.join()... re.join()...? Do they exist? (newbie questions...)

googleboy mynews44 at yahoo.com
Sat Oct 1 08:39:09 EDT 2005


Hi.

In some google posts I searched suggested that there was a list.join()
thing that I assume works like string.join [which I notice is now
deprecated in favour of S.join()]

It seems that I have been misled.

I start with a text file that I split up to run some formatting over
the various sections with re.split.  I want to join it back together
again with a | delimeter and write it out to a new file.  I looked for
a re.join, but it seems that doesn't exist.   I looked for a list.join
after reading the aforementioned posts, but it doesn't seem to exist
either.

To get it to work I did this:


List[0] = list0
List[1] = list1
List[2] = list2
List[3] = list3
cat_list = list0 + '|' + flatblurb + '|' + flatcontents + '|' + flates
+ '\n'
file.write(concat_list)


But it seems to me that there is probably something more pythonic than
having to go about it in such a laborious fashion....

Would someone be so kind as to fill me in?

TIA!

googleboy




More information about the Python-list mailing list