Life is short, you need Python

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 50 下一页
摘要: 现在每天测试到时候会与Linux打交道,自然也会用到环境变量了。看了网上几篇文章,结合自己到实践和看法,总结以下Linux的环境变量吧。一、什么是环境变量?环境变量相当于给系统或用户应用程序设置的一些参数, 具体起什么作用这当然和具体的环境变量相关.Linux是一个多用户的操作系统。多用户意味着每个用户登录系统后,都有自己专用的运行环境。而这个环境是由一组变量所定义,这组变量被称为环境变量。用户可以对自己的环境变量进行修改以达到对环境的要求。二、定制环境变量环境变量是和Shell紧密相关的,它是通过Shell命令来设置的。环境变量又可以被所有当前用户所运行的程序所使用。对于bash来说,可以通 阅读全文
posted @ 2011-05-19 14:06 runfox545 阅读(930) 评论(0) 推荐(0) 编辑
摘要: 为了让editplus能够实现python语法加亮和自动完成功能我们必须下载两个文件, 下载地址:http://www.editplus.com/files/pythonfiles.zip 解压到editplus 的安装目录下。压缩包有三个文件,此处我们用到两个,python.acp 文件和python_extd.stx 文件。 Acp 文件是自动完成文件,stx 文件是语法加亮文件。怎样加载呢?方法如下: tools->preferences->Setting & syntax 下,首先新建一个文件类型,我们命名为python,扩展名(file extensions)栏里 阅读全文
posted @ 2011-05-17 10:49 runfox545 阅读(5781) 评论(0) 推荐(2) 编辑
摘要: Skype 是一家全球性互联网电话公司™,它通过在全世界范围内向客户提供免费的高质量通话服务,正在逐渐改变电信业。Skype是网络即时语音沟通工具。具备IM所需的其他功能,比如视频聊天、多人语音会议、多人聊天、传送文件、文字聊天等功能。它可以免费高清晰与其他用户语音对话,也可以拨打国内国际电话,无论固定电话、手机、小灵通均可直接拨打,并且可以实现呼叫转移、短信发送等功能。2011年5月11日,微软宣布以85亿美元收购Skype。 阅读全文
posted @ 2011-05-17 10:19 runfox545 阅读(258) 评论(0) 推荐(0) 编辑
摘要: File System -- os, os.path, shutilThe *os* and *os.path* modules include many functions to interact with the file system. The *shutil* module can copy files.os module docs filenames = os.listdir(dir) -- list of filenames in that directory path (not including . and ..). The filenames are just the nam 阅读全文
posted @ 2011-04-28 15:32 runfox545 阅读(533) 评论(0) 推荐(0) 编辑
摘要: sina微博http://t.sina.com.cn/1941893380没办法,被逼的!! 阅读全文
posted @ 2011-04-28 11:16 runfox545 阅读(709) 评论(0) 推荐(0) 编辑
摘要: 在需要在字符中使用特殊字符时,python用反斜杠(\)转义字符。如下表:原始字符串有时我们并不想让转义字符生效,我们只想显示字符串原来的意思,这就要用r和R来定义原始字符串。如:print r'\t\r'实际输出为“\t\r”。转义字符描述\(在行尾时)续行符\\反斜杠符号\'单引号\"双引号\a响铃\b退格(Backspace)\e转义\000空\n换行\v纵向制表符\t横向制表符\r回车\f换页\oyy八进制数yy代表的字符,例如:\o12代表换行\xyy十进制数yy代表的字符,例如:\x0a代表换行\other其它的字符以普通格式输出 阅读全文
posted @ 2011-04-28 10:48 runfox545 阅读(152486) 评论(5) 推荐(3) 编辑
摘要: # sort.py # -*- coding: gbk -*# 这个类用来演示如何对自定义对象进行排序 class Sortobj: a = 0 b = '' def __init__(self, a, b): self.a = a self.b = b def printab(self): print self.a, self.b # 演示对字符串列表进行排序 samplelist_str = ['blue','allen','sophia','keen'] print samplelist_str sample 阅读全文
posted @ 2011-04-27 17:26 runfox545 阅读(723) 评论(0) 推荐(0) 编辑
摘要: 若python文件中出现中文字符,运行时会出现如下错误SyntaxError: Non-ASCII character '\xd5' in file sort.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details可以在python的文件开始处加入下面声明即可fix这个error# -*- coding: gbk -* 阅读全文
posted @ 2011-04-27 17:25 runfox545 阅读(2439) 评论(0) 推荐(0) 编辑
摘要: List MethodsHere are some other common list methods.list.append(elem) -- adds a single element to the end of the list. Common error: does not return the new list, just modifies the original. list.insert(index, elem) -- inserts the element at the given index, shifting elements to the right. list.exte 阅读全文
posted @ 2011-04-26 17:03 runfox545 阅读(1930) 评论(0) 推荐(0) 编辑
摘要: sorted(...) sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted listiterable:是可迭代类型;cmp:用于比较的函数,比较什么由key决定,有默认值,迭代集合中的一项;key:用列表元素的某个属性和函数进行作为关键字,有默认值,迭代集合中的一项;reverse:排序规则. reverse = True 或者 reverse = False,有默认值。返回值:是一个经过排序的可迭代类型,与iterable一样。refer to :http://wiki.python.org/moin/H 阅读全文
posted @ 2011-04-26 15:12 runfox545 阅读(1112) 评论(1) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 50 下一页
白月黑羽 Python教程 白月黑羽Python