V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · 4299 views
    This topic created in 4759 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   ·   Solana   ·   6025 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    ♥ Do have faith in what you're doing.