Grant Edwards wrote: > On 2005-08-13, yaffa <[EMAIL PROTECTED]> wrote: > >>i have the following lines of python code: >> >> couch = incident.findNextSibling('td') >> price = couch.findNextSibling('td') >> sdate = price.findNextSibling('td') >> city = sdate.findNextSibling('td') >> strUrl = addr.b.string >>currently what this ends up doing is creating something like this >> >>couch3201/01/2004newyork >> >>now what i want to do is add a semicolon after the couch, price, sdate, >>city so that i get something like this >> >>couch;32;01/01/2004;new york > > > Try this: > > s = ';'.join([couch,price,sdate,city]) > print s
I'll risk myself with something like: s = ';'.join([tag.string for tag in [couch,price,sdate,city]]) Of course, from the question I wouldn't have any clue. I just like doing some guessing on problems I know nothing about. ;) >>p.s. i tried couch = couch + ';' >>and then i tried couch = couch + ";" > > both of those should have worked fine. Not really. It seems to me the OP is using BeautifulSoup (or some other SGML parser). In this case, couch and others are not strings but objects. It may also be that strUrl is their parent (but I wouldn't know, how would I?) > Perhaps you ought to read through the tutorial? That's always useful. However, the first thing is to put the minimal context in your question to help the people you want your answers from understanding your issue. I would advise you to read tutorials and documentations on the modules you're using as well as learning to ask meaningful questions[1]. [1] http://www.catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list