版本157和212间的区别 (跳过第55版)
于2020-04-01 10:30:39修订的的版本157
大小: 8833
编辑: czk
备注:
于2020-06-05 17:12:03修订的的版本212
大小: 13103
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 5: 行号 5:
<<Include(Python介绍)>>

参考:
 * [[http://en.wikipedia.org/wiki/Python_%28programming_language%29|Wikipedia:Python_programming_language]] ([[http://zh.wikipedia.org/wiki/Python|Wikipedia上的Python编程语言简介]])
 * [[http://www.python.org/|Python Official Web]]
 * [[http://en.wikipedia.org/wiki/Python_syntax_and_semantics|Python语法]] from Wikipedia
 * [[http://www.linuxjournal.com/article/3882|Why_Python]] by Eric Raymond [[http://blog.sina.com.cn/s/blog_53982851010008b8.html|why python中文版]]
 * [[http://www.norvig.com/python-lisp.html|Python for Lisp Programmers]]

== Python解释器 ==
 * CPython http://python.org/
 * Stackless Python http://www.stackless.com/
   * [[StacklessPython]]
 * Ironpython (Python for .Net) https://ironpython.net/
 * Jython (Python for Java) https://www.jython.org/
 * PYPY https://www.pypy.org/

== Python开发环境 ==
 * Mac上Python环境准备: https://sourabhbajaj.com/mac-setup/Python/
 * [[http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html|One Day of IDLE Toying]] (中文版: [[http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/IDLE-chinese.htm|摆弄一天IDLE]])
 * [[http://ftp.ntua.gr/mirror/python/idle/doc/idle2.html|Using IDLE]] by Daryl Harms
 * [[https://docs.python-guide.org/dev/virtualenvs/|pipenv, virtual env]]
 * [[Python介绍]]
行号 29: 行号 8:
行号 36: 行号 16:
 * [[https://en.wikibooks.org/wiki/Python_Programming|Python Programming - Wikibooks]]
行号 39: 行号 20:
 * [[http://xahlee.info/python/index.html|Python by Example]] by Xah Lee
 * [[http://www.alan-g.me.uk/l2p/|Learn to Program by Alan G]]
 * [[https://inventwithpython.com/|Invent with Python]]
 * [[http://chinesepython.org/pythonfoundry/easytut.html|Python 非編程員教學]]
 * [[http://www.norvig.com/python-lisp.html|Python for Lisp Programmers]]

已经过时的教程(基于已经淘汰的Python 2):
行号 41: 行号 30:
 * [[http://xahlee.info/python/index.html|Python by Example]] by Xah Lee  * [[https://github.com/livewires/python/releases|The LiveWires Python Course]] 已过时
 * [[http://www.pentangle.net/python/handbook/|Handbook of the Physics Computing Course]] 已过时
 * [[http://www.math.pku.edu.cn/teachers/lidf/docs/Python/python-tutorial.html|Python入门]]

== Python解释器 ==
 * CPython http://python.org/
 * Stackless Python http://www.stackless.com/
   * [[StacklessPython]]
 * Ironpython (Python for .Net) https://ironpython.net/
 * Jython (Python for Java) https://www.jython.org/
 * [[https://www.pypy.org/|PyPy]]
   * [[https://speed.pypy.org/|PyPy Speed]]
 * [[http://hylang.org|Hylang]] A dialect of Lisp that's embedded in Python

== Python开发环境 ==
 * Mac上Python环境准备: https://sourabhbajaj.com/mac-setup/Python/
 * [[http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html|One Day of IDLE Toying]] (中文版: [[http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/IDLE-chinese.htm|摆弄一天IDLE]])
 * [[http://ftp.ntua.gr/mirror/python/idle/doc/idle2.html|Using IDLE]] by Daryl Harms
 * [[https://docs.python-guide.org/dev/virtualenvs/|Pipenv & Virtual Environments]]
 * [[https://hackernoon.com/reaching-python-development-nirvana-bb5692adf30c|Why you should use pyenv + Pipenv for your Python projects]]
 * [[https://pipenv.pypa.io/en/latest/advanced/|Advanced Usage of Pipenv]]
 * [[https://python-poetry.org/|poetry]]
 * [[https://github.com/David-OConnor/pyflow|pyflow]]
 * [[https://github.com/ofek/hatch|hatch]]
 * [[https://github.com/takluyver/flit|flit]]
 * [[https://briefcase.readthedocs.io/en/latest/|briefcase]]
 * [[http://andrewsforge.com/article/python-new-package-landscape/|Python's New Package Landscape]]
 * [[https://www.pypa.io/en/latest/|PyPA]]
 * [[https://github.com/pypa/warehouse|warehouse]]
行号 45: 行号 62:

 * [[http://en.wikipedia.org/wiki/Python_syntax_and_semantics|Python语法]] from Wikipedia
行号 50: 行号 69:
 * [[https://docs.python.org/3/reference/index.html|Python Reference Manual]]
 * [[https://realpython.com/async-io-python/|Async IO in Python: A Complete Walkthrough]]
 * [[https://snarky.ca/how-the-heck-does-async-await-work-in-python-3-5/|How the heck does async/await work in Python 3.5?]]
 * [[https://rhettinger.wordpress.com/2011/05/26/super-considered-super/|Python’s super() considered super! ]]
 * [[https://docs.python.org/3/library/asyncio-task.html|Coroutines and Tasks]]
 * [[https://www.python.org/dev/peps/pep-0492/|PEP 492 -- Coroutines with async and await syntax]]


== 代码风格 ==

 * [[https://www.python.org/doc/essays/styleguide/|Python Style Guide]]
 * https://www.python.org/dev/peps/pep-0008/
 * https://www.python.org/dev/peps/pep-0257/
 * [[https://docs.python-guide.org/writing/style/|Code Style -- The Hitchhiker's Guide to Python]]
 * [[https://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/|Open Sourcing a Python Project the Right Way]]
行号 53: 行号 86:

 * [[Why Python is More Productive than Java]]
行号 54: 行号 89:
 * [[http://docs.python.org/ref/ref.html|Python Reference Manual]] (中文版: [[http://chinesepython.org/pythonfoundry/ref2.3/tmp/|Python语言参考手册]] )
 * [[http://docs.python.org/lib/lib.html|Python Library Reference]] (中文版: [[http://chinesepython.org/pythonfoundry/lib2.3/tmp/|Python库参考手册]])
 * [[http://www.linuxjournal.com/article/3882|Why_Python]] by Eric Raymond [[http://blog.sina.com.cn/s/blog_53982851010008b8.html|why python中文版]]

 * [[https://woodpecker.org.cn/|WoodPecker中文社区]]
 * [[https://www.reddit.com/r/programming/comments/eroi/of_snakes_and_rubies_or_why_i_chose_python_over/|Of snakes and rubies; Or why I chose Python over Ruby]]
行号 59: 行号 96:
 * [[http://www.pentangle.net/python/handbook/|Handbook of the Physics Computing Course]]
行号 63: 行号 100:
 * [[http://www.livewires.org.uk/python/|The LiveWires Python Course]]
行号 78: 行号 114:
 * [[https://www.youtube.com/watch?v=DWODIO6aCUE|Better Web App]]

== GUI Toolkit ==
 * [[https://www.zhidaow.com/post/python-modules-you-should-know|Python你必须知道的十个库]]
 * [[http://www.pythontip.com/blog/post/9771/|【外刊IT评论网】Python高效编程技巧]]
 * [[http://blog.sina.com.cn/s/blog_4e8581890102e29u.html|孩子们为什么要学Python编程?]]
 * [[https://pythonconquerstheuniverse.wordpress.com/2009/10/03/python-java-a-side-by-side-comparison/|Python & Java: A Side-by-Side Comparison]]
 * [[https://book.douban.com/subject/1241032/|Jython程序设计]]
 * [[https://lists.ubuntu.com/archives/ubuntu-devel/2020-February/040918.html|Python2 removal for Ubuntu focal]]
 * [[https://app.getpocket.com/read/2956522352|Python 2.7.18, the end of an era]]
 * [[http://python-future.org/|Easy, clean, reliable Python 2/3 compatibility]]
 * [[https://computers-are-fast.github.io/|Do you know how much your computer can do in a second?]]
 * [[https://medium.com/@jherreras/python-microlibs-5be9461ad979|Python Microlibs]]

== Python库 ==

=== 标准库 ===

 * [[http://docs.python.org/lib/lib.html|Python Library Reference]]

=== GUI Toolkit ===
行号 87: 行号 139:
== Web 开发 == === DB ===

 * [[https://elasticsearch-dsl.readthedocs.io/en/latest/|ElasticSearch DSL]]

=== 网络 ===

 * [[https://github.com/MagicStack/uvloop|uvloop]]: asyncio + libuv + Cython,再配上httptools做HTTP parser,从[[https://magic.io/blog/uvloop-blazing-fast-python-networking/|benchmark]]看起来性能非常强劲。

=== Web 开发 ===
行号 90: 行号 150:
 * [[https://wiki.python.org/moin/WebProgramming|WebProgramming - Python Wiki]]
行号 91: 行号 152:

== Windows ==
 * [[https://www.youtube.com/watch?v=DWODIO6aCUE|Better Web App]]

=== Windows ===
行号 100: 行号 162:
== 图像 == === Mac ===
 * [[http://undefined.org/python/py2app.html|Py2app]]

=== 多媒体 ===
行号 103: 行号 168:
   * [[http://twainmodule.sourceforge.net/|TWAIN]]
行号 104: 行号 170:

== python游戏相关 ==
 * 通过ffmpeg处理视频、音频 https://github.com/kkroening/ffmpeg-python
 * PyDUB:在python中直接处理音频 https://github.com/jiaaro/pydub

=== 游戏 ===
行号 112: 行号 180:
== Python与正则表达式 == === 字符串 ===

 * [[https://docs.python.org/3/howto/unicode.html|Unicode Howto]]
行号 116: 行号 186:

== Python数据处理 ==
 * [[https://click.palletsprojects.com/en/7.x/|Click]] 命令行参数处理

=== 数据处理 ===

 * [[https://numpy.org/|numpy]]
 * [[https://www.scipy.org/|scipy]]
行号 119: 行号 193:

== 其它 ==
 * [[https://pytorch.org/|PyTorch]]
 * [[https://scikit-learn.org/stable/|Scikit-Learn]]

=== 其它 ===
行号 125: 行号 201:
 * [[http://springpython.webfactional.com/|Spring Python]]: 为什么Python不需要像Spring这样的东西?
 * [[http://www.dabeaz.com/ply/ply.html#ply_nn2|PLY]] Python Lex-Yacc

Python

1. Python入门教程

已经过时的教程(基于已经淘汰的Python 2):

2. Python解释器

3. Python开发环境

4. Python语法

5. 代码风格

6. 参考资料

7. Python库

7.1. 标准库

7.2. GUI Toolkit

7.3. DB

7.4. 网络

  • uvloop: asyncio + libuv + Cython,再配上httptools做HTTP parser,从benchmark看起来性能非常强劲。

7.5. Web 开发

7.6. Windows

7.7. Mac

7.8. 多媒体

7.9. 游戏

7.10. 字符串

7.11. 数据处理

7.12. 其它

8. Python的字符编码处理

对于中文用户,特别需要关注Python的编码技术. 列举一些常用的技巧。

chr(i): 将一个0到255的整数转换为一个字符.
ord(c): 返回单个字符c的整数顺序值.普通字符返回[0,255]中的一个值,Unicode字符返回 [0,65535]中的一个值
unichr(i): 将一个0到65535的整数转换为一个Unicode字符
  • 代码中的编码设置,应该在代码最初两行内包含:

# -*- coding: UTF-8 -*-
  • 获得/设置系统的缺省编码

sys.getdefaultencoding()

sys.setdefaultencoding('utf-8')
  • 获得文件系统的文件名的编码

sys.getfilesystemencoding()
  • 获得当前终端的输入、输出编码

      sys.stdout.encoding

      sys.stdin.encoding
  • 编码转换(先转换为unicode,再转换为具体的编码),有两种方法:

      unicode('abc', 'mbcs').encode('utf-8')

      'abc'.decode('mbcs').encode('utf-8')

Python (2020-06-05 17:12:03由czk编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.