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

关于 CS50 Lecture 6 Python 演示时出现错误的原因

  •  
  •   input2output · 2022-08-10 11:13:56 +08:00 · 1547 次点击
    这是一个创建于 618 天前的主题,其中的信息可能已经有所发展或是发生改变。

    视频地址(含出错时刻定位):CS50 2021 - Lecture 6 - Python (SDR)

    stdio 输出 Found 是前一个演示代码 name.py 的结果,
    但在这个演示代码 phonebook.py 中,python 却输出了上一个演示代码的结果,
    就算是缓存的话,文件名也不一样啊,所以不太能理解为什么会出现这个错误

    查找了几个地方,没找到后续跟踪的调查,所以还请 V 友帮忙看看是哪里的问题

    2 条回复    2022-08-10 23:05:15 +08:00
    bhy
        1
    bhy  
       2022-08-10 12:31:42 +08:00
    一般是因为什么地方有 `import names`, 所以 `names.py` 就被执行了。
    caqiko
        2
    caqiko  
       2022-08-10 23:05:15 +08:00
    可能是 cs50 引入了与当前目录下文件同名的包,看到有个 numbers 文件,有可能是这个锅。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1390 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:25 · PVG 01:25 · LAX 10:25 · JFK 13:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.