I am out of trial and error again Lists

Tobiah toby at tobiah.org
Thu Oct 23 10:51:11 EDT 2014


On 10/22/2014 01:30 PM, Seymore4Head wrote:
> def nametonumber(name):
>      lst=[""]
>      for x,y in enumerate (name):
>          lst=lst.append(y)
>      print (lst)
>      return (lst)
> a=["1-800-getcharter"]
> print (nametonumber(a))#18004382427837
>
>
> The syntax for when to use a () and when to use [] still throws me a
> curve.
>
> For now, I am trying to end up with a list that has each character in
> "a" as a single item.



>>> a = "1-800-getcharter"
>>> list(a)
['1', '-', '8', '0', '0', '-', 'g', 'e', 't', 'c', 'h', 'a', 'r', 't', 'e', 'r']
>>>




More information about the Python-list mailing list