摘要:
题目:字符串标志符,可以检测长度为1的标识符,并可以识别Python中的关键字。 阅读全文
摘要:
Given an array of integers, every element appearstwiceexcept for one. Find that single one.思路:队列排序,两两个对比,找出不相同的一个 阅读全文
摘要:
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
摘要:
import randomdef datarand(): originaldata = random.randint(1,10) return originaldatadef guessdata(originaldata): flag = 0 while(flag==0):... 阅读全文
摘要:
# -*- coding: cp936 -*-import random#生成1-200之间的随机数def datalist(num): data=[] for i in range(0,num): data.append(random.randint(1,200)) ... 阅读全文
摘要:
# -*- coding: cp936 -*-def isIpaddr(addr): flag=0 data=addr.split(".") if len(data)==4: for i in range(0,4): if 0<int(data[... 阅读全文
摘要:
# -*- coding: cp936 -*-fname=raw_input("filename:")printtry: fobj=open(fname,'r')except IOError,e: print "%s not exists" %fname,eelse: for ea... 阅读全文
摘要:
# -*- coding: cp936 -*-import os#当前平台的行终止符ls=os.linesepfname='C:\\Users\Administrator\\Desktop\\clt_workspace\\20150526.txt'#判断文档是否存在,存在则继续,不存在则终止whil... 阅读全文