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
lisisi
V2EX  ›  Python

from models import User 和 from orm import models 中的两个 models 会冲突吗?

  •  
  •   lisisi · 10 天前 · 828 次点击
    from models import User
    from orm import models
    

    这两行引入中,两个 models 会冲突吗?第 2 行这个 models 会覆盖第 1 行的 models 吗?

    3 条回复    2025-04-16 09:29:04 +08:00
    wyntalgeer
        1
    wyntalgeer  
       10 天前
    不会;不会。
    NoOneNoBody
        2
    NoOneNoBody  
       10 天前
    这样看不会

    1. 这两句顺序调换就可能会了
    2. 如果当前目录内有个 models.py 可能有问题

    不建议用 和 module 同名来命名 .py 文件,组织项目文件时就要考虑这点
    frostming
        3
    frostming  
       6 天前
    1. 这两句顺序调换就可能会了
    2. 如果当前目录内有个 models.py 可能有问题

    两种都不会
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2366 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 16:01 · PVG 00:01 · LAX 09:01 · JFK 12:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.