I am a beginner, and its been hard to know where to search info about the problem, but I have been all day searching solutions yet I haven’t found anything that would help
words I am trying to import:
words = ["aback","abaft","abandoned","abashed"... etc]
my file In which I am trying to import:
from words import words import random import string
I am trying to import my file words to the dictionary sorter but pylance does not recognize the words file.
I have found some tutorials that seem to be useful for me but are only for MacOS and I am in Windows
if some one can comment a possible solution that would help me a lot
Advertisement
Answer
from words import words
The first words should be a folder or module or python file.
You can create a new python file named words.py. And in this file:
words = ["aback","abaft","abandoned","abashed"... etc]
Then you can use from words import words
to get this array.
By the way, please do not use spaces in file naming. You can use dictionaryRandomSorter or dictionary_random_sorter instead of dictionary random sorter
.