05 2021 档案
摘要:如何解两个字符串,是否只是字符位置变换:四种方法。 1、标记位置法,每个都标记,找到后将位置标记位None 2、排序比较法,先把两个字符串拆为列表, 并排序,排序后一个个比较 3、暴力匹配法,将前者所有可能的组合枚举出来,看是否有跟后者匹配的 4、计数比较法,分别计数两个字符串中包含字符的数量,然后
阅读全文
摘要:注意,类中的方法,self这个参数是必须的。 >>> class fraction: def __init__(self,top,bottom): self.num = top self.den = bottom def show(): print("%d / %d"%(self.num,self.
阅读全文
摘要:exists : 强调的是是否返回结果集,不要求知道返回什么, 比如: select name from student where sex = 'm' and mark exists(select 1 from grade where ...) ,只要exists引导的子句有结果集返回,那么exi
阅读全文
摘要:1、join的用法 >>> import random >>> def createFunction1(): str1 = [] str2 = 'abcdefghijklmnopqrstuvwxyz ' count = 0 while(count < 27): ch = random.choice(
阅读全文

浙公网安备 33010602011771号