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

新手求教简单问题

  •  
  •   lovecook · Jul 29, 2014 · 3068 views
    This topic created in 4496 days ago, the information mentioned may be changed or developed.
    Python如何变换一个数值的符号,比如5变成-5, -9变成9,谢过。
    3 replies  •  2014-07-29 09:32:27 +08:00
    mengzhuo
    mengzhuo
    Jul 29, 2014
    1
    x = -x

    --------------------
    每天正能量,坚持不吐槽
    hotcha0111
    hotcha0111
    Jul 29, 2014
    2
    n = ~n + 1
    ...
    lovecook
    lovecook
    OP
    Jul 29, 2014
    3
    楼上的方法试了,都可以呃,谢谢了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4625 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 06:08 · PVG 14:08 · LAX 22:08 · JFK 01:08
    ♥ Do have faith in what you're doing.