On Mon, 16 Apr 2001 22:10:34 +0200, Alex Martelli, in the persona of <aleaxit at yahoo.com>, brought forth the following words...: >"Jim Richardson" <warlock at eskimo.com> wrote in message >news:slrn9dk6ga.98l.warlock at gargoyle.myth... >> I am stumped, str(listname) returns a string of list, but includes the >commas >> and [] that the list would show if printed. I want a string copy of a >list, is >> there a simple way I have missed? please? thanks > >What is each item in your list? If each item is a string, presumably what >you're asking for is to have all items joined -- either simply juxtaposed, >without separators, or maybe with (e.g.) a blank joining them? If so, >then the join method of string objects will perform either task: > > juxtaposed = ''.join(listname) > > blankjoined = ' '.join(listname) > > >If your list's items are NOT strings, you presumably want to make them >into strings before joining them. If str is acceptable for that: > > juxtap1 = ''.join(map(str, listname)) > >etc. Or, you may use another function that "makes each of your items >into a string" more effectively, if there is one. > Thanks, this helps a lot. It's a list of mixed types, ints and strings, I tried join but it didn't work at first because of the strings issue, some kind poster gave me a hint that it was for lists of strings only and that got me over the hump. Musta been a brain blockage on my part. Thanks all :) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4