I am out of trial and error again Lists
Seymore4Head
Seymore4Head at Hotmail.invalid
Wed Oct 22 18:32:02 EDT 2014
BTW I know I didn't check for Caps yet.
On Wed, 22 Oct 2014 18:30:17 -0400, Seymore4Head
<Seymore4Head at Hotmail.invalid> wrote:
>On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
><Seymore4Head at Hotmail.invalid> wrote:
>
>One more question.
>if y in str(range(10)
>Why doesn't that work.
>I commented it out and just did it "long hand"
>
>def nametonumber(name):
> lst=[]
> nx=[]
> for x in (name):
> lst.append(x)
> for y in (lst):
> #if y in str(range(10)):
> if y in "1234567890":
> nx.append(y)
> if y in " -()":
> nx.append(y)
> if y in "abc":
> nx.append("2")
> if y in "def":
> nx.append("3")
> if y in "ghi":
> nx.append("4")
> if y in "jkl":
> nx.append("5")
> if y in "mno":
> nx.append("6")
> if y in "pqrs":
> nx.append("7")
> if y in "tuv":
> nx.append("8")
> if y in "wxyz":
> nx.append("9")
> number="".join(str(e) for e in nx)
> return (number)
>a="1-800-getcharter"
>print (nametonumber(a))#1800 438 2427 837
>a="1-800-leo laporte"
>print (nametonumber(a))
>a="1 800 callaprogrammer"
>print (nametonumber(a))
More information about the Python-list
mailing list