[英]I have tried all solutions I have found yet I can't find a solution - Pylance(missingImports) for vs code
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.我正在尝试将我的文件单词导入字典排序器,但 pylance 无法识别单词文件。
I have found some tutorials that seem to be useful for me but are only for MacOS and I am in Windows我找到了一些似乎对我有用但仅适用于 MacOS 的教程,我在 Windows
if some one can comment a possible solution that would help me a lot如果有人可以评论一个可能对我有很大帮助的解决方案
from words import words
The first words should be a folder or module or python file.第一个单词应该是文件夹或模块或 python 文件。
You can create a new python file named words.py .您可以创建一个名为words.py的新 python 文件。 And in this file:
在这个文件中:
words = ["aback","abaft","abandoned","abashed"... etc]
Then you can use from words import words
to get this array.然后你可以使用
from words import words
来获取这个数组。
By the way, please do not use spaces in file naming.顺便说一句,请不要在文件命名中使用空格。 You can use dictionaryRandomSorter or dictionary_random_sorter instead of
dictionary random sorter
.您可以使用dictionaryRandomSorter或dictionary_random_sorter而不是
dictionary random sorter
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.