摘要:
获得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() 阅读全文
摘要:
生成调试文件的源代码#!/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 +=... 阅读全文
摘要:
#!/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/ 阅读全文
摘要:
#!/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.''' 阅读全文