摘要:
#!/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'); 阅读全文
摘要:
#!/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 阅读全文
摘要:
#!/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'); 阅读全文
摘要:
#!/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();... 阅读全文
摘要:
#!/usr/bin/python#coding=gb2312 f=open('bok.log','rw');#f.write('wocaonima');#f.write('haoba');print f.read();f.close(); 阅读全文