摘要: from multiprocessing import Poolimport os,timedef f(i): time.sleep(0.5) print('in the process',os.getpid()) return i+100def b(x): #回调函数b的参数为f的return值。 阅读全文
posted @ 2018-05-21 23:24 Python从入门到放弃第一集 阅读(741) 评论(0) 推荐(0) 编辑
摘要: from multiprocessing import Process,Managerimport os,timedef f(d,l): d[os.getpid()]=os.getpid() l.append(os.getpid()) print (d) print (l)if __name__== 阅读全文
posted @ 2018-05-21 22:32 Python从入门到放弃第一集 阅读(760) 评论(0) 推荐(0) 编辑
摘要: def isPalindrome(s): s1='' for i in s: if (ord(i)>=48 and ord(i)<=57) or (ord(i)>=65 and ord(i)<=90) or (ord(i)>=97 and ord(i)<=122): s1+=i.lower() s2 阅读全文
posted @ 2018-05-21 18:59 Python从入门到放弃第一集 阅读(2134) 评论(0) 推荐(0) 编辑
摘要: class Solution: def addDigits(self, num): sum=0 for i in list(str(num)): sum+=int(i) if sum<10: return sum else: return self.addDigits(sum) 阅读全文
posted @ 2018-05-21 15:51 Python从入门到放弃第一集 阅读(1385) 评论(0) 推荐(0) 编辑