This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients ezio.melotti, ned.deily, ronaldoussoren, 方文添
Date 2017-05-08.11:11:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494241876.81.0.726776378561.issue30305@psf.upfronthosting.co.za>
In-reply-to
Content
I think you are misunderstanding how join works.
join is useful when you have a list of strings, and you want to combine them together, possibly specifying a separator.  The syntax is separator.join(list_of_strings), for example:
>>> '-'.join(['foo', 'bar', 'baz'])
'foo-bar-baz'

What you are doing is: new_item = new_item.join((item + ';'))
Here new_item is the separator, and (item + ';') is a string (a sequence of characters), so the separator is added between each character of the string:
>>> '-'.join('foobarbaz')
'f-o-o-b-a-r-b-a-z'

new_item will grow bigger and bigger, and since you keep adding it between each character of the item, Python will soon run out of memory:
>>> 'newitem'.join('foobarbaz')
'fnewitemonewitemonewitembnewitemanewitemrnewitembnewitemanewitemz'

You probably want to add the items to a new list, and after the for loop you just need to do '; '.join(new_list_of_items), or, if you want a ; at the end, you can add (item + ';') to the list and then use ' '.join(new_list_of_items).

I also suggest you to use the interactive interpreter to experiment with join.
History
Date User Action Args
2017-05-08 11:11:16ezio.melottisetrecipients: + ezio.melotti, ronaldoussoren, ned.deily, 方文添
2017-05-08 11:11:16ezio.melottisetmessageid: <1494241876.81.0.726776378561.issue30305@psf.upfronthosting.co.za>
2017-05-08 11:11:16ezio.melottilinkissue30305 messages
2017-05-08 11:11:16ezio.melotticreate