How to convert a string to a list?

posted by web10 on 2009-06-22 00:00:00
 
s="1,2,3,5,6,7,8,9"
 
Is it possibile to convert the string to a list?
dail avatar
dail
12
Sure!
s="1,2,3,5,6,7,8,9"
my_list=s.split(",")
print my_list
 
split() function returns a list of the words in the string, using "," (comma) as the delimiter string.
49 answers - 0 questions
  Positive        Negative



Answer the question



Top Users
  • dail (12)
  • livin52 (3)
  • camu (3)
  • softweb (2)
  • Nadine (1)
  • Josware (1)
  • lfelipecr (1)
  • gregoriohc (1)
  • Mitu (1)
  • ryan714 (1)