摘要:
#!/usr/bin/python -tt# Copyright 2010 Google Inc.# Licensed under the Apache License, Version 2.0# http://www.apache.org/licenses/LICENSE-2.0# Google's Python Class# http://code.google.com/edu/languages/google-python-class/# Basic string exercises# Fill in the code for the functions below. main( 阅读全文
摘要:
Here are some of the most common string methods. A method is like a function, but it runs "on" an object. If the variable s is a string, then the code s.lower() runs the lower() method on that string object and returns the result (this idea of a method running on an object is one of the ba 阅读全文
摘要:
Python is packaged with many standard modules which are bundled with a standard installation of the python interpreter, so you don't have do anything extra to use them. Commonly used standard python modules include:sys -- access to exit(), argv, stdin, stdout, ... re -- regular expressions os -- 阅读全文
摘要:
URL: http://code.google.com/intl/zh-CN/edu/Thanks Google Guys for sharing those information to us!Enjoy it! 阅读全文
摘要:
迭代器为类序列对象提供了一个类序列的接口。python的迭代无缝地支持序列对象,而且它还允许程序员迭代非序列类型,包括用户定义的对象。迭代器用起来很灵巧,你可以迭代不是序列但表现处序列行为的对象,例如字典的键、一个文件的行,等等。迭代器的作用如下:•提供了刻扩展的迭代器接口;•对列表迭代带来了性能上的增强;•在字典迭代中性能提升;•创建真正的迭代接口,而不是原来的随即对象访问;•与所有已经存在的用户定义的类以及扩展得模拟序列和映射的对象向后兼容;•迭代非序列集合(例如映射和文件)时,可以创建更简洁可读的代码#iter and generator#the first try#========== 阅读全文
摘要:
Python supports a concept called "list comprehensions". It can be used to construct lists in a very natural, easy way, like a mathematician is used to do. 常见python编程方法#the first try#=============================number = range(10)size = len(number)event = []i = 0while i < size: if i%2 == 阅读全文
摘要:
APK是AndroidPackage的缩写,即Android安装包(apk)。APK是类似Symbian Sis或Sisx的文件格式。通过将APK文件直接传到Android模拟器或Android手机中执行即可安装。apk文件和sis一样,把android sdk编译的工程打包成一个安装程序文件,格式为apk。 APK文件其实是zip格式,但后缀名被修改为apk,通过UnZip解压后,可以看到Dex文件,Dex是Dalvik VM executes的全称,即Android Dalvik执行程序,并非Java ME的字节码而是Dalvik字节码。文件结构 一个APK文件结构为: 1. META-I 阅读全文
摘要:
EasyInstall is a package manager for the Python programming language that provides a standard format for distributing Python programs and libraries (based on the Python Eggs wrapper). easy_install is a module bundled with setuptools, a third-party library meant to enhance the Python standard library 阅读全文
摘要:
Why IPython is a better ShellThis is a quick list of features that make IPython a better shell than the one you are using right now. You should use the 'sh' profile ('pysh' shortcut, or 'ipython -p sh') to access all of these features without configuration. Use e.g. %bookmark 阅读全文
摘要:
1. 下载readline模块http://newcenturycomputers.net/projects/readline.html2. install readlinemodule3. edit and configure pythonstartup file# python startup fileimport sysimport readlineimport rlcompleterimport atexitimport os# tab completionreadline.parse_and_bind('tab: complete')# history filehis 阅读全文