版本200和201间的区别
于2020-04-21 14:11:10修订的的版本200
大小: 12090
编辑: czk
备注:
于2020-04-21 14:12:20修订的的版本201
大小: 12090
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 23: 行号 23:
 * [[http://www.norvig.com/python-lisp.html|Python for Lisp Programmers]]

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

 * 另类的Python教程: [[attachment:我的名字叫Python.pdf]] (太古老,已过时)
 * [[http://www.wag.caltech.edu/home/rpm/python_course/|Python Short Course]] by Richard P. Muller (太古老,已过时)
 * [[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入门]]
行号 25: 行号 34:
 * [[http://en.wikipedia.org/wiki/Python_syntax_and_semantics|Python语法]] from Wikipedia
行号 27: 行号 35:
 * [[http://www.norvig.com/python-lisp.html|Python for Lisp Programmers]]
行号 49: 行号 56:
已经过时的教程(基于已经淘汰的Python 2):

 * 另类的Python教程: [[attachment:我的名字叫Python.pdf]] (太古老,已过时)
 * [[http://www.wag.caltech.edu/home/rpm/python_course/|Python Short Course]] by Richard P. Muller (太古老,已过时)
 * [[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入门]]
行号 59: 行号 58:
 * [[http://en.wikipedia.org/wiki/Python_syntax_and_semantics|Python语法]] from Wikipedia

Python

1. Python入门教程

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

参考:

2. Python解释器

3. Python开发环境

4. Python语法

5. 代码风格

6. 参考资料

7. Python库

7.1. 标准库

7.2. GUI Toolkit

7.3. 网络

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

7.4. Web 开发

7.5. Windows

7.6. Mac

7.7. 多媒体

7.8. 游戏

7.9. 字符串

7.10. 数据处理

7.11. 其它

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.