On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head <Seymore4Head@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)) -- https://mail.python.org/mailman/listinfo/python-list