推荐学习书目
› 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 · Apr 26, 2013 · 4607 views
    This topic created in 4905 days ago, the information mentioned may be changed or developed.
    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 replies  •  1970-01-01 08:00:00 +08:00
    fanzheng
        1
    fanzheng  
       Apr 26, 2013   ❤️ 1
    你怎么使用 . 来分开列表呢? 不是用 , 么?
    Rosicky
        2
    Rosicky  
       Apr 26, 2013   ❤️ 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
       Apr 26, 2013
    @fanzheng 谢谢~PDF显示的不清。。
    rrfeng
        4
    rrfeng  
       Apr 26, 2013
    哈哈哈哈,我打印的pdf也全显示 .
    不过还好我比较聪明!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2566 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:35 · PVG 22:35 · LAX 07:35 · JFK 10:35
    ♥ Do have faith in what you're doing.