'module' object has no attribute 'choice' - trying to use random.choice

后端 未结 5 1226
挽巷
挽巷 2020-12-31 00:48

Could someone please tell me what I may be doing wrong. I keep getting this message when I run my python code:

import random

foo = [\'a\', \'b\', \'c\', \         


        
5条回答
  •  Happy的楠姐
    2020-12-31 01:14

    In short, Python's looking in the first file it finds named "random", and isn't finding the choice attribute.

    99.99% of the time, that means you've got a file in the path/directory that's already named "random". If that's true, rename it and try again. It should work.

提交回复
热议问题