When I try to import a module in python(.py file) it gives a syntax error. The module name starts with a numeral. Is that the reason for the syntax error?
python中函数名的命名规则,解决方案
Yes, that is the reason for the syntax error. There are various ways of importing it anyway, but it's better to rename the module.
python语言命名。The reason is that variable names can't start with a numeral. Hence you can't do
import 123foo
or even
123foo = __import__('123foo')
They are both syntax errors. You can do
foo123 = __import__('123foo')
But it's better to just rename the module to foo123 and import it normally instead.
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态