On Tue, Aug 10, 2010 at 3: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". > > a = ["3", "2", "5", "1", "0"] my_string = "".join(a) Or, this even works: "".join(["3", "2", "5", "1", "0"]) > 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? > The str part of str.join() is the string where the result is stored, so you can start off with an empty string: "" The join argument is listed as an iterable, whis is what your list is. > > Thank you, > ~Corey Richardson > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor