Skip to content Skip to sidebar Skip to footer

Attribute Error 'module' Object Has No Attribute 'ascii_letters'

Why do I receive the error message in the title from the code below? Edit: Cause I didn't pay attention to how I wrote 'ascii'. Thanks everyone The code below works fine on my Ipho

Solution 1:

It should be string.ascii_letters letters instead of string.acsii_letters. If that's a typo in code statement here only, then your guess must be right, there is another string module in your PYTHONPATH. Open python shell,

importstringprint(string.__file__)

to ensure string is being imported from right path. If its not remove that path from PYTHONPATH.

Solution 2:

In python 3 I found that using the string.ascii_letters works as string.letters results in an AttributeError.

Solution 3:

You have a typo. It should be string.ascii_letters or string.letters. You can look at the attributes of the string module with dir(string) and see what you can access.

Solution 4:

i had the same issue the reason was that the name of the file is the same of the module name . so just rename your file the module will work well

Post a Comment for "Attribute Error 'module' Object Has No Attribute 'ascii_letters'"