上一页 1 ··· 7 8 9 10 11
摘要: 获得n个字符#!/usr/bin/pythonblank = " " *3print blank +"2372"写入文件#!/usr/bin/python#_*_coding:utf8_*_writeDebugFile = open ("File.py","w")writeDebugFile.write("你好!\n")writeDebugFile.write("wuxi")writeDebugFile.close() 阅读全文
posted @ 2011-12-12 13:51 wuxi812 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 生成调试文件的源代码#!/usr/bin/python#_*_coding:utf8_*_import osimport sysimport re"""行匹配(必须是对应的符号),例{},(),[]等,head表示前半部分,tail表示后半部分"""def match(head, tail,fileName): try: f = open(fileName) lineSum = 0 line = f.readline() while line: summary = 0 lineSum +=... 阅读全文
posted @ 2011-12-12 13:41 wuxi812 阅读(695) 评论(0) 推荐(1) 编辑
摘要: #!/bin/bash#wget -nd -p -o tianya.html http://www.tianya.cn/techforum/articleslist/0/414.shtml #获得网页信息function GetWebContent(){iconv -f gb2312 414.shtml|awk ' BEGIN { FS="target=\"_blank\">";}{ if(/更新时间/){ flag = "true"; } if(flag == "true"){ if(/<a/ 阅读全文
posted @ 2011-12-12 12:46 wuxi812 阅读(650) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python# Filename: inherit.pyclass SchoolMember: '''Represents any school member.''' def __init__(self, name, age): self.name = name self.age = age print'(Initialized SchoolMember: %s)'% self.name def tell(self): '''Tell my details.''' 阅读全文
posted @ 2011-12-12 09:25 wuxi812 阅读(2182) 评论(0) 推荐(0) 编辑
摘要: python的异常处理机制设计的比较传统,在日常的开发中,基本满足我的需要下面就python的异常,几点小小的讨论tommy@lab3:~$ pythonPython 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)[GCC 4.3.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> 1/0Traceback (most recent call l 阅读全文
posted @ 2011-12-11 11:21 wuxi812 阅读(2933) 评论(0) 推荐(0) 编辑
摘要: 1 #!/bin/bash 2 sqlite3 contact.db << ! 3 drop table contact; 4 create table contact ( 5 name char(32), 6 address char(32) 7 ); 8 insert into contact(address,name) values("jiangshang","wuxi"); 9 ! 10 echo 'select *from contact;'|sqlite3 contact.db|awk 'BEGIN{FS= 阅读全文
posted @ 2011-12-10 15:26 wuxi812 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 1 #!/bin/bash 2 sqlite3 contact.db << ! 3 drop table contact; 4 create table contact ( 5 name char(32), 6 address char(32) 7 ); 8 insert into contact(address,name) values("jiangshang","wuxi"); 9 ! 10 sqlite3 contact.db<<! 11 insert into contact (address,name) values(& 阅读全文
posted @ 2011-12-10 15:23 wuxi812 阅读(361) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2011-11-25 13:55 wuxi812 阅读(8) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11