python - 导入错误: cannot import name 'my_function' from 'abc'

标签 python python-3.x import google-colaboratory abc

我正在尝试将 python 脚本从计算机加载到 google colab,但显示导入错误

enter image description here

最佳答案

将文件名 abc.py 更改为其他名称,例如 testo.py,它将起作用。

from google.colab import files

upload = files.upload()

!ls检查

testo.py

尝试:

import testo

testo.myfunction()

世界你好!

说明:abc 是内置模块,您不应在模块中使用该名称。检查这个问题了解更多info .

关于python - 导入错误: cannot import name 'my_function' from 'abc' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66486992/

相关文章:

python - 从在 python 中导入我的函数的文件中获取变量

python - 排除区间的端点

python - Pandas 如何使用字符串对列重新采样

python - 在 n 行后在 pandas 中求和

mysql - 1054,字段列表中的未知列 'index'

java - TestLink中的 "testCasePathName"是什么?

python - Pandas Dataframe 特殊计数

python - 为什么 elif 在 if 语句之前运行? Python

matlab - Octave 导入函数

python - 是否可以从 python 代码中删除所有 __future__ 语句,而不会影响其使用 python 3.7.1 的功能?