V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
oldbird
V2EX  ›  Python

from a import b 中 a 是模块名, b 是什么?

  •  
  •   oldbird · 2020-04-15 14:13:59 +08:00 · 3038 次点击
    这是一个创建于 1443 天前的主题,其中的信息可能已经有所发展或是发生改变。

    b 可以是函数、类、子模块?

    12 条回复    2020-04-16 14:45:57 +08:00
    oahebky
        1
    oahebky  
       2020-04-15 14:17:04 +08:00
    a 可以是包( package )名
    ysoserious
        2
    ysoserious  
       2020-04-15 14:18:14 +08:00
    也可以是变量
    xiri
        3
    xiri  
       2020-04-15 14:18:35 +08:00
    b 可以是任何东西,甚至可以是变量
    yuruizhe
        4
    yuruizhe  
       2020-04-15 14:39:27 +08:00   ❤️ 2
    from package.module import class 或 function 或 variable
    zooo
        5
    zooo  
       2020-04-15 15:17:34 +08:00
    引入某个一个大的范围的一部分
    purensong
        6
    purensong  
       2020-04-15 17:32:02 +08:00
    管它是什么,你点一下就知道
    Gakho
        7
    Gakho  
       2020-04-15 18:13:06 +08:00
    都是对象
    sadfQED2
        8
    sadfQED2  
       2020-04-15 18:49:03 +08:00 via Android
    管它是什么,你点一下就知道了+1
    szxczyc
        9
    szxczyc  
       2020-04-16 03:17:10 +08:00 via iPhone
    import torch as tf
    edimetia3d
        10
    edimetia3d  
       2020-04-16 07:40:16 +08:00
    顺路广告一下 https://www.tinyedi.com/python-for-cpp-programner/
    文章中搜索 from 看相关的内容即可
    wozhizui
        11
    wozhizui  
       2020-04-16 08:08:39 +08:00
    变量名,地址呗
    ijrou
        12
    ijrou  
       2020-04-16 14:45:57 +08:00
    Python 的 from import 和 import 的区别?
    https://www.zhihu.com/question/38857862/answer/136790745
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2718 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 15:39 · PVG 23:39 · LAX 08:39 · JFK 11:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.