var answer = answerEditText.text.toString()
Log.d("debug", answer)
answer = answer.replace("[^A-Za-z0-9 ]", "").toLowerCase()
Log.d("debug", answer)
SavingAccount类继承自Account(抽象类)。当main.py导入SavingAccount时如下:
来自bank.SavingAccount的导入SavingAccount
它出现"没有名为' Account'"的模块。有人可以知道如何解决它吗?
输出窗口中的完整错误代码如下:
$date = Carbon::parse('next monday')->toDateString();
Acccount.py
bank
__init__.py
Account.py
SavingAccount.py
main.py
SavingAccount.py
Traceback (most recent call last):
File "main.py", line 5, in <module>
from bank.SavingAccount import SavingAccount
File "\bank\SavingAccount.py", line 1, in <module>
from Account import Account
ModuleNotFoundError: No module named 'Account'
答案 0 :(得分:1)
你应该改变
from Account import Account
到
from .Account import Account
建议在包装内使用后一种相对导入方法。