[英]How to import a class from a different package in the present package in python?
I have created a package in pycharm by the name "Classes in python".我在 pycharm 中创建了一个名为“python 中的类”的 package。 How can I use a class of that package in a separate package?
如何在单独的 package 中使用 package 的 class? I am using the statement "import classes in python.MyDate" and I am getting an error.
我正在使用语句“在 python.MyDate 中导入类”,但出现错误。
I suppose you are getting a syntax error, to import your class with name 'Point' from a module named 'xx' just type: from xx import Point
我想您遇到语法错误,要从名为“xx”的模块中导入名称为“Point”的 class,只需键入:
from xx import Point
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.