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

python菜鸟求助

  •  
  •   amyhyde · 2013-04-26 16:48:44 +08:00 · 3453 次点击
    这是一个创建于 4009 天前的主题,其中的信息可能已经有所发展或是发生改变。
    database = [
    ['albert'. '1234'].
    ['dilbert'. '4242'].
    ['smith'. '7524'].
    ['jones'. '9843']
    ]
    username = raw_input('User name: ')
    pin = raw_input('PIN code: ')

    if [username.pin] in database: print 'Access granted'


    这段代码一直报错,说是有语法问题(There's an error in your program: invalid syntax)。我看不出来,求助ing
    4 条回复    1970-01-01 08:00:00 +08:00
    fanzheng
        1
    fanzheng  
       2013-04-26 16:50:58 +08:00   ❤️ 1
    你怎么使用 . 来分开列表呢? 不是用 , 么?
    Rosicky
        2
    Rosicky  
       2013-04-26 16:54:26 +08:00   ❤️ 1
    database = [
    ['albert', '1234'],
    ['dilbert', '2345'],
    ['simith', '3456'],
    ['johns', '4567']
    ]
    username = raw_input("user name: ")
    pin = raw_input("PIN code: ")
    if [username, pin] in database: print "Access granted"
    else: print "Access rejected"
    amyhyde
        3
    amyhyde  
    OP
       2013-04-26 16:55:57 +08:00
    @fanzheng 谢谢~PDF显示的不清。。
    rrfeng
        4
    rrfeng  
       2013-04-26 16:57:45 +08:00
    哈哈哈哈,我打印的pdf也全显示 .
    不过还好我比较聪明!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3649 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:56 · PVG 12:56 · LAX 21:56 · JFK 00:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.