syntax - Python NameError -
list1 = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z] item in list1: print item
not sure why above code throwing error:
nameerror: "name 'a' not defined"
in addition using quotes properly, don't retype alphabet.
>>> import string >>> string.ascii_lowercase 'abcdefghijklmnopqrstuvwxyz' >>> l = list(string.ascii_lowercase) >>> print l ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', ... >>> help(string)
Comments
Post a Comment