小编Liq*_*ake的帖子

如何说出除破折号(“-”)之外的任何字符

我们如何编写一个正则表达式来表示“如果中间有破折号,则匹配失败”

我有几行组成为 3958.3r - 5v,有些没有破折号,例如:3958.3v4r。我能够得到带有破折号的那些,但不仅限于那些没有破折号的

regex

5
推荐指数
1
解决办法
2万
查看次数

没有名为“ file1.py”的模块;test1不是软件包

我正在尝试将我的代码模块化,但遇到了问题。

我的文件夹是这样构造的:

code
   |_main.py
   |_test1
           |_calcA.py (which contains a method)
   |_test2
           |_calcB.py (which contains another method)
   |_test3
           |_calcC.py (which contains another method)
Run Code Online (Sandbox Code Playgroud)

现在我的main.py包含以下行:

import sys; import pprint
pprint.pprint(sys.path)
from test1.calccircle.py import calcA
from test2.calctriangle.py import calcB
from test3.calccarre.py import calcB
Run Code Online (Sandbox Code Playgroud)

出现以下错误:

ImportError:没有名为“ test1.calcA.py”的模块;'test1.calcA'不是一个软件包

python python-3.x

2
推荐指数
1
解决办法
2059
查看次数

标签 统计

python ×1

python-3.x ×1

regex ×1