ord function problem from newbie

7stud bbxx789_05ss at yahoo.com
Tue Mar 18 05:18:37 CET 2008

David.J.Anderso... at gmail.com wrote:
>  I convert all to lowercase,
> import string
> 	small = string.lower(name)
> 	print "Here is the calculated value:"
>         print small
> 	for ch in small:
> 		v = ord(ch)-96
>                 print v

I don't know if you are using an out of date book or what, but
generally you are not going to be importing string.  For example,

my_str = "HELLO"
small = my_str.lower()
print small


More information about the Python-list mailing list