上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 48 下一页
摘要: #!/usr/bin/python#coding=gb2312 while True: reply=raw_input('Enter text:'); if reply=='stop': break; try: num=int(reply); except: print('Bad!'*8); else: print(int(reply)**2);print('bye'); 阅读全文
posted @ 2013-03-04 15:48 墨迹哥's 阅读(219) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python#coding=gb2312 f=open('/var/log/apache2/access.log','r');log=f.readline().rstrip();log_home=log.split();print log_home;ip=log_home[0];date=log_home[3].replace('[','');point=log_home[5].replace('"','');path=log_home[6];offer=log_ho 阅读全文
posted @ 2013-03-04 15:47 墨迹哥's 阅读(444) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python#coding=gb2312 S='pallyer';print S.replace('all', 'bok');line='aa bb cc dd';col=line.split();print col;print line.startswith('a');print line.endswith('d'); 阅读全文
posted @ 2013-03-04 15:46 墨迹哥's 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python#coding=gb2312 class Worker: def __init__(self,name,pay): self.name=name; self.pay=pay; def lastName(self): return self.name.split()[0]; def giveRaise(self,percent): self.pay*=(1.0+percent); bob=Worker('ken', 5000000);print bob.lastName();... 阅读全文
posted @ 2013-03-04 15:45 墨迹哥's 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python#coding=gb2312 f=open('bok.log','rw');#f.write('wocaonima');#f.write('haoba');print f.read();f.close(); 阅读全文
posted @ 2013-03-04 15:44 墨迹哥's 阅读(217) 评论(0) 推荐(0) 编辑
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 48 下一页