Life is short, you need Python

摘要: Python中的splitlines用来分割行。当传入的参数为True时,表示保留换行符 \n。通过下面的例子就很明白了:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--mulLine="""Hello!!!WellcometoPython'sworl... 阅读全文
posted @ 2010-07-05 10:36 runfox545 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 转换大小写和其他语言一样,Python为string对象提供了转换大小写的方法:upper() 和 lower()。还不止这些,Python还为我们提供了首字母大写,其余小写的capitalize()方法,以及所有单词首字母大写,其余小写的title()方法。函数较简单,看下面的例子:Code highlighting produced by Actipro CodeHighlighter (fr... 阅读全文
posted @ 2010-07-05 10:08 runfox545 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 方法一,使用[::-1]:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--s='python'prints[::-1]方法二,使用reverse()方法:Code highlighting produced by Actipro CodeHighlig... 阅读全文
posted @ 2010-06-28 09:44 runfox545 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 开始--运行--cmd 进入命令提示符 输入netstat -aon 即可看到所有连接的PID 之后在任务管理器中找到这个PID所对应的程序如果任务管理器中没有PID这一项,可以在任务管理器中选"查看"-"选择列" 经常,我们在启动应用的时候发现系统需要的端口被别的程序占用,如何知道谁占有了我们需要的端口,很多人都比较头疼,下面就介绍一种非常简单的方法,希望对大家有用假如我们需要确定谁占用了我们的... 阅读全文
posted @ 2010-06-25 12:34 runfox545 阅读(95461) 评论(4) 推荐(8) 编辑
摘要: join 方法用于连接字符串数组Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--s=['a','b','c','d']print''.join(s)print'-'.join(s)输出结果:abcda-b-c-d使用 % 连接多个变量Code high... 阅读全文
posted @ 2010-06-24 15:34 runfox545 阅读(399) 评论(0) 推荐(0) 编辑
摘要: Python中的strip用于去除字符串的首位字符,同理,lstrip用于去除左边的字符,rstrip用于去除右边的字符。这三个函数都可传入一个参数,指定要去除的首尾字符。注意的是,传入的是一个字符数组,编译器去除两端所有相应的字符,直到没有匹配的字符,比如:Code highlighting produced by Actipro CodeHighlighter (freeware)http:/... 阅读全文
posted @ 2010-06-24 15:22 runfox545 阅读(322) 评论(0) 推荐(0) 编辑
摘要: Python中打印字符串时可以调用ljust(左对齐),rjust(右对齐),center(中间对齐)来输出整齐美观的字符串,使用起来非常简单,包括使用第二个参数填充(默认为空格)。看下面的例子就会明白了:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--... 阅读全文
posted @ 2010-06-24 11:12 runfox545 阅读(234) 评论(0) 推荐(0) 编辑
摘要: If realize this funciton by C language:[代码]In Python:[代码]The example code is come from coderzh's blog, thank you very much!isinstance(object, classinfo)Return true if the object argument is an instanc... 阅读全文
posted @ 2010-06-22 17:21 runfox545 阅读(343) 评论(0) 推荐(0) 编辑
摘要: Come from Mr. Flow------------------------------------------------------------------------------------------------------------啥叫软件配置管理?——一个通俗的解释作为一位从事软件配置管理工作的同志,我经常被亲朋好友问到的是,我有时候要向各级领导游说的... 阅读全文
posted @ 2010-06-22 14:47 runfox545 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Python provide build-in function to help us translate bettween Char and ASCII, for example:[代码] 阅读全文
posted @ 2010-06-21 12:35 runfox545 阅读(163) 评论(0) 推荐(0) 编辑
白月黑羽 Python教程 白月黑羽Python