推荐学习书目
› 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
jtsai
V2EX  ›  Python

求助: Python 字符串 '0x01' 转换成 数字

  •  
  •   jtsai · Apr 21, 2017 · 4360 views
    This topic created in 3485 days ago, the information mentioned may be changed or developed.

    int('0x01') 报错~~~ 咋办

    7 replies  •  2017-04-22 10:39:43 +08:00
    fy
    fy
    Apr 21, 2017❤️3
    1
    int('0xaa01', 16)
    TerrenceSun
    TerrenceSun
    Apr 21, 2017
    2
    int('0x01',0)
    nyanyh
    nyanyh
    Apr 21, 2017
    3
    struct.pack('i', '0x01')
    Yingruoyuan
    Yingruoyuan
    Apr 21, 2017❤️1
    4
    int(eval('0x01'))
    aristotll
    aristotll
    Apr 21, 2017
    5
    @Yingruoyuan eval 性能不好吧
    phrack
    phrack
    Apr 22, 2017 via Android
    6
    @aristotll 不用管 eval 的性能吧,谁会代码里到处是 eval 〒_〒
    Yingruoyuan
    Yingruoyuan
    Apr 22, 2017
    7
    @aristotll
    @phrack
    @jtsai
    是的,这个比较适合救急用,楼上的 int('0xaa01', 16)是更好的方法
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1272 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 20:31 · PVG 04:31 · LAX 12:31 · JFK 15:31
    ♥ Do have faith in what you're doing.