On Tue, Aug 10, 2010 at 2:49 PM, Corey Richardson <kb1...@aim.com> wrote:
> Hello, tutors.
>
> I'm attempting to make a string from the items of a list.
> For example, if the list is ["3", "2", "5", "1", "0"], I desire the string
> "32510".
>
> I've looked into str.join(), but I can't figure it out. Can someone either
> point me in a different direction, or explain how join() works?
>

str.join is the one you want. remember that it's a method of the str
class, and it takes an iterable as an argument. Your list is an
iterable. Try invoking the method on different kinds of strings with
your list as argument, and see if you can figure out how it works.
Maybe start like this:

>>> l = ["3", "2", "5", "1", "0"]
>>> a = "string"
>>> a.join(l)

HTH,
Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to