版本20和106间的区别 (跳过第86版)
于2006-06-10 18:24:45修订的的版本20
大小: 3598
编辑: czk
备注:
于2020-03-31 13:38:02修订的的版本106
大小: 1943
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 1: 行号 1:
[[TableOfContents]]
= Python语言 =
## page was renamed from Python语言
 * Python教程:[[Python游戏开发基础]]
 * [[StacklessPython]]
 * [[Python小程序]]
 * [[Python使用技巧]]
 * [[Python参考资料]]
 * 课程:[[Python游戏开发基础]]
 * [[Python相关软件]]
 * [[Python介绍]] from Wikipedia
行号 4: 行号 11:
Pythonic: == 参考资料 ==
行号 6: 行号 13:
A few neologisms have come into common use within the Python community. One of the most common is "pythonic", which can have a wide range of meanings related to program style. To say that a piece of code is pythonic is to say that it uses Python idioms well; that it is natural or shows fluency in the language. Likewise, to say of an interface or language feature that it is pythonic is to say that it works well with Python idioms; that its use meshes well with the rest of the language. <<Include(Python参考资料)>>
行号 8: 行号 15:
In contrast, a mark of unpythonic code is that it attempts to "write C++ (or Lisp, or Perl) code in Python"—that is, provides a rough transcription rather than an idiomatic translation of forms from another language. === 入门教程 ===
 * [[https://developers.google.com/edu/python|Google's Python Class]]
行号 10: 行号 18:
The prefix Py- can be used to show that something is related to Python. Examples of the use of this prefix in names of Python applications or libraries include Pygame, a binding of SDL to Python (commonly used to create games), PyUI, a GUI encoded entirely in Python, and PySol, a series of solitaire card games programmed in Python.  * [[http://en.wikipedia.org/wiki/Python_syntax_and_semantics|Python语法]] from Wikipedia
 * [[http://www.linuxjournal.com/article/3882|Why_Python]] by Eric Raymond [[http://wiki.woodpecker.org.cn/moin/WhyPython/WhyPythonZh|why python中文版]]
 * [[http://www.amk.ca/python/howto/advocacy/|Python_Advocacy_HOWTO]] by A.M. Kuchling
 * 另类的Python教程: [[attachment:我的名字叫Python.pdf]]
 * python 与 COM [[http://oreilly.com/catalog/pythonwin32/chapter/ch12.html|Advanced Python and COM]]
 * Using IDLE: [[attachment:idleUse05b.zip]]
 * Learning to Program: attachment: http://www.freenetpages.co.uk/hp/alan.gauld/
 * Learn To Program CD: [[attachment:LearnToProgramCD.zip]]
 * Tkinter Life Preserver: http://www.python.org/doc/life-preserver/
 * Python介绍视频[[http://video.google.com/videoplay?docid=9023849479319414382|Introducing Python]]
 * [[https://towardsdatascience.com/30-python-best-practices-tips-and-tricks-caefb9f8c5f5|30 Python Best Practices, Tips, And Tricks]]
 * [[https://docs.python-guide.org/dev/virtualenvs/|pipenv, virtual env]]
 * [[https://docs.python-guide.org/writing/gotchas/|Python Gotchas]]
python游戏相关:
 * pygame: http://www.pygame.org/
 * panda3d: http://www.panda3d.org/
 * renpy: http://www.renpy.org/wiki/renpy/Home_Page
行号 12: 行号 36:
Users and admirers of Python—most especially those considered knowledgeable or experienced—are often referred to as Pythonists, Pythonistas, and Pythoneers

== 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库 =
 * 图像获取:linux平台下使用sane模块,Windows平台下使用twain模块

 * 图像处理["PythonImageLibrary中文手册"]

 * 使用_winreg模块操纵windows注册表

 * 读取excel:用xlrd包。把excel转成csv,使用csv库操作。

 * 将python程序打包成windows下可以执行的exe文件:使用[http://www.py2exe.org/ py2exe]模块

 * 加密:Python Cryptography Toolkit http://www.amk.ca/python/code/crypto
 * 在.net平台上使用python:[http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 IronPython]

学习资料
 * [https://secure.wikimedia.org/wikipedia/zh/wiki/Python Wikipedia:Python]
 * [http://diveintopython.org/ Dive Into Python]
 * [http://www.woodpecker.org.cn/obp/diveintopython-zh-5.4/zh-cn/dist/html/toc/index.html dive into python最新中文版]
 * [http://www.python.org/ Python官方站点]
 * [http://python.cn/ Python中文社区]
 * [http://groups.google.com/group/comp.lang.python Python讨论组comp.lang.python]
 * [http://www.ibiblio.org/obp/thinkCSpy/ How to Think Like a Computer Scientist (Learning with Python)]
 * [http://pine.fm/LearnToProgram/ Learn to Program(ruby)]
 * [http://www-128.ibm.com/developerworks/cn/linux/theme/special/index.html#python]
Python与正则表达式:
 * http://docs.python.org/lib/module-re.html
 * http://www.amk.ca/python/howto/regex/
 * Mastering Regular Expressions 2nd Edition, By Jeffrey E. F. Friedl

参考资料

1. 入门教程

python游戏相关:

Python与正则表达式:

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

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