[Tutor] Newbie question: join() string method

wesley chun wescpy at gmail.com
Mon Nov 27 23:28:44 CET 2006


>     strgOutput=",".join(str(i) for i in LotNumbers)   #??????converting list
> to string to store it.

note that here, you are *not* converting the list to a string to store
it.  you are converting each list member to a string and creating a
new "list" (actually generator [expression]) for the string.join()
method to takes its contents (now strings) and concatenate them
together into one large string delimited by ','s.

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list