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

从零学习 Python 的话,应该学习 py3 还是 py2?

  •  
  •   imswing · 2016-07-11 11:38:08 +08:00 · 5878 次点击
    这是一个创建于 3088 天前的主题,其中的信息可能已经有所发展或是发生改变。
    听说 py3 不向下兼容?
    39 条回复    2016-07-13 09:38:31 +08:00
    linpf
        1
    linpf  
       2016-07-11 12:01:12 +08:00
    皮肉 3
    yx30
        2
    yx30  
       2016-07-11 12:04:27 +08:00
    3 吧
    ChiangDi
        3
    ChiangDi  
       2016-07-11 12:07:56 +08:00 via Android
    你不会搜索一下嘛,这个问题在 V2 被问过好多次了
    vertigo
        4
    vertigo  
       2016-07-11 12:11:19 +08:00
    py3 比较好,也渐渐克服之前库少的问题了
    HLT
        5
    HLT  
       2016-07-11 12:13:32 +08:00
    毫无疑问 P3
    fy
        6
    fy  
       2016-07-11 12:22:24 +08:00
    楼主你问之前搜一下,每周都要有个两三次
    Arrowing
        7
    Arrowing  
       2016-07-11 12:27:54 +08:00
    我怎么感觉天天有人问这问题呢, 233333333
    kkzxak47
        8
    kkzxak47  
       2016-07-11 12:38:40 +08:00 via Android
    没有历史遗留问题就选 3
    MyFaith
        9
    MyFaith  
       2016-07-11 12:39:27 +08:00
    我已经在去年从 Python2 转到 Python3 了,推荐你从 3 入手,因为早晚都要转到 3 , Python2 的编码问题是最头疼的。
    hiluluke
        10
    hiluluke  
       2016-07-11 12:40:35 +08:00
    3
    tangzx
        11
    tangzx  
       2016-07-11 12:43:15 +08:00 via iPhone
    我军 60 秒后到达战场
    flipped123
        12
    flipped123  
       2016-07-11 12:45:45 +08:00
    肯定用 3 啊,还用问?
    misaka19000
        13
    misaka19000  
       2016-07-11 13:03:26 +08:00
    v 站日经贴。。。

    果断 3 啊,没什么好说的了
    kulove
        14
    kulove  
       2016-07-11 13:28:33 +08:00
    3
    Pzdmultiverse
        15
    Pzdmultiverse  
       2016-07-11 14:45:21 +08:00
    楼主,来坐个同学吧!
    CRH
        16
    CRH  
       2016-07-11 15:25:31 +08:00
    mikicomo
        17
    mikicomo  
       2016-07-11 15:28:25 +08:00
    学生果断 3 ,马上要工作的..从 2 开始吧反正转 3 也很快
    oh8
        18
    oh8  
       2016-07-11 16:25:14 +08:00
    使用《 Python 学习手册》, 2 和 3 一起学, 2 和 3 一起学, 2 和 3 一起学, 2 和 3 一起学, 2 和 3 一起学!
    qinxi
        19
    qinxi  
       2016-07-11 17:16:18 +08:00
    先买个尺子吧.
    LuvLetter
        20
    LuvLetter  
       2016-07-11 17:35:37 +08:00
    Which Python Should I Use?
    Version choice may be mandated by your organization, but if you ’ re new to Python and learning on your own, you may be wondering which version to install. The answer here depends on your goals. Here are a few suggestions on the choice.
    When to choose 3.X: new features, evolution
    If you are learning Python for the first time and don ’ t need to use any existing 2.X code, I encourage you to begin with Python 3.X. It cleans up some longstanding warts in the language and trims some dated cruft, while retaining all the original core ideas and adding some nice new tools. For example, 3.X ’ s seamless Unicode model and broader use of generators and functional techniques are seen by many users as assets. Many popular Python libraries and tools are already available for Python 3.X, or will be by the time you read these words, especially given the con- tinual improvements in the 3.X line. All new language evolution occurs in 3.X only, which adds features and keeps Python relevant, but also makes language definition a constantly moving target — a tradeoff inherent on the leading edge.
    When to choose 2.X: existing code, stability
    If you ’ ll be using a system based on Python 2.X, the 3.X line may not be an option for you today. However, you ’ ll find that this book addresses your concerns, too, and will help if you migrate to 3.X in the future. You ’ ll also find that you ’ re in large company. Every group I taught in 2012 was using 2.X only, and I still regularly see useful Python software in 2.X-only form. Moreover, unlike 3.X, 2.X is no longer being changed — which is either an asset or liability, depending on whom you ask. There ’ s nothing wrong with using and writing 2.X code, but you may wish to keep tabs on 3.X and its ongoing evolution as you do. Python ’ s future remains to be written, and is largely up to its users, including you.
    When to choose both: version-neutral code
    Probably the best news here is that Python ’ s fundamentals are the same in both its lines — 2.X and 3.X differ in ways that many users will find minor, and this book is designed to help you learn both. In fact, as long as you understand their differ- ences, it ’ s often straightforward to write version-neutral code that runs on both Pythons, as we regularly will in this book. See Appendix C for pointers on 2.X/3.X migration and tips on writing code for both Python lines and audiences.
    ayaseangle
        21
    ayaseangle  
       2016-07-11 17:37:57 +08:00
    为什么 v 站都是这种问题,感觉质量大不如以前了。。
    wizardforcel
        22
    wizardforcel  
       2016-07-11 19:21:50 +08:00
    v 站的信息熵持续走高啊。。。
    sunwei0325
        23
    sunwei0325  
       2016-07-11 22:21:46 +08:00
    scrapy, supervisor, fabric 都能用 py3?
    herozhang
        24
    herozhang  
       2016-07-11 22:26:47 +08:00
    3
    wojiaodaxiaxia
        25
    wojiaodaxiaxia  
       2016-07-11 23:17:06 +08:00
    屁眼 3
    Licamla
        26
    Licamla  
       2016-07-11 23:21:34 +08:00
    去年也在纠结这个,然后一边学 python3 一边断断续续地翻译《 Supporting Python 3 (支持 Python 3 )》,
    地址: http://my.oschina.net/soarwilldo/blog/508410#OSC_h1_1

    最后工作中用 python2.7 写 python3 风格代码,然而没有用到多少书中的那么多的内容。
    neoblackcap
        27
    neoblackcap  
       2016-07-12 00:12:35 +08:00
    3, 接下来的 3 的效率会越来越高,而且还有各种更好的特性,更好的标准库
    likuku
        28
    likuku  
       2016-07-12 00:49:37 +08:00
    py2.7 向上 /py3 兼容
    peter999
        29
    peter999  
       2016-07-12 00:58:51 +08:00
    当然是 2 ,好多库都不支持 3 ,当然按照许多人的说法你可以自己改造这些库让他们支持 3 ,如果你可以说服老板的话
    latyas
        30
    latyas  
       2016-07-12 01:45:46 +08:00
    @peter999 举几个必须要用 2 的库的例子?
    vexjoe
        31
    vexjoe  
       2016-07-12 02:26:11 +08:00 via iPhone
    其实这个日经一点也没关系,这样新手们就有更大的几率看到 Py3 的推荐,从而进入 Py3 的社区,这样 Py3 的生态就会渐渐繁荣,不至于造成无人问津,然后僵死于 Py2 的情况。
    jugelizi
        32
    jugelizi  
       2016-07-12 07:57:20 +08:00
    @latyas pdfminer 不支持 3
    autulin
        33
    autulin  
       2016-07-12 08:57:01 +08:00 via Android
    看需求吧
    比如我做作业要爬虫,于是想到用 scrapy ,可是官方推荐在 py2 上用
    如果只是想语法入门,那还用在乎 3 还是 2 吗?
    yufpga
        34
    yufpga  
       2016-07-12 09:16:59 +08:00
    都学了不就得了,学会其中一种,再看另外一种时间成本又不高.
    latyas
        35
    latyas  
       2016-07-12 09:31:26 +08:00 via iPhone
    @jugelizi pypi 上搜了一下不是有 3 的移植版么?
    smallsix
        36
    smallsix  
       2016-07-12 11:32:03 +08:00
    python3
    SlipStupig
        37
    SlipStupig  
       2016-07-12 13:42:52 +08:00
    @autulin python2 和 3 已经语法发送了较大的变化了
    fire5
        38
    fire5  
       2016-07-12 21:51:19 +08:00
    直接学习 go 嘿嘿
    autulin
        39
    autulin  
       2016-07-13 09:38:31 +08:00 via Android
    @SlipStupig 我没说清楚,我想说的是思想学到了,语法只是形式上的问题而已
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1805 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:22 · PVG 00:22 · LAX 08:22 · JFK 11:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.