Python模块导入方式疑问?
ringa_lee
ringa_lee 2017-04-18 09:40:55
0
1
263
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker

sqlalchemy模块已经被导入,为什么下面还需要以“.”号连接导入子模块?
我有看到说某些特定的子模块必须以“.”号连接的形式明确标出才能够导入?如果是,那些子块有这种需要,我在哪里可以查找呢?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
PHPzhong

from a import b, b is a class, function or constant, from a.b import c, b is a package (module). Simply put, classes and functions can be used directly, and packages have their own classes and functions

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!