简体   繁体   English

我已经尝试了我找到的所有解决方案,但我找不到解决方案 - Pylance(missingImports) for vs code

[英]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

the error popping:错误弹出:

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 .您可以使用dictionaryRandomSorterdictionary_random_sorter而不是dictionary random sorter

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我尝试调试此代码,但似乎无法正常工作 - I have tried debugging this code but it doesn't seem to work 我找不到我的微位代码有什么问题,即使我指定了变量也找不到 - I can't find what's wrong with my micro bit code, variables are not found even if i have specified them 有没有另一种方法可以做到这一点? 我已经尝试了 6 个版本的代码,运行时似乎无法得到结果 - is there another way to make this ? I have tried 6 versions of code, I can not seem to get a result when I run it 我尝试了很多解决方案,但运行服务器时没有显示图像。 ;( 在 django - I have tried many solutions but image is not showing when I run server. ;( on django Python 3我认为我的类型不匹配,但是找不到 - Python 3 I think I have a type mismatch but can't find it 如何进入 VS Code 用于 pylance 的环境? - How do I get into the environment VS Code is using for pylance? 我的自动 cookieclicker 代码有错误,如下所示,有人知道如何解决这个问题吗? 我尝试了不同的东西,但还没有奏效 - I have an error with my automatic cookieclicker code, as seen below, does anyone know how to fix this? I tried different things but nothing worked yet 嗨,我尝试用 python 编写这段代码,但是我有一个错误,我希望有人可以帮助我 - Hi, I have tried to write this code in python, but i have a error, i hope that someone could help me 如何编写这个 python 代码。 我试过但没有用 - How to write this python code. I have tried it but didn't work 为什么我的代码会打印一个我尚未分配的值? - Why does my code print a value that I have not assigned as yet?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM