摘要:
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值。 阅读全文
摘要:
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__== 阅读全文
摘要:
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 阅读全文
摘要:
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) 阅读全文