alp = 'abcdefghijklmnopqrstuvwxyzabc' deftoInt(ch): for i in range(0,len(alp)): if(alp[i] == ch): return i return-1 defaddTwo(ch): for i in range(0,len(alp)): if(alp[i] == ch): return alp[i+2]
for i in str: ans = addTwo(i) if ans != None: print(addTwo(i),end='') else: print(i,end='')
p = {} with open("hehe.html","r") as f: for k,s in zip(f,range(0,1000000000000000)): for j in k: if j in p: p[j] = p[j] + 1 else: p[j] = s
ans = sorted(p.items(),key=lambda d:d[1],reverse = False) for ps in range(0,len(ans)): if ans[ps][1] < 2000: print(ans[ps][0],end='')
网上解答
1 2 3 4 5 6 7 8 9 10 11 12 13
s = ''.join([line.rstrip() for line in open('hehe.html')]) OCCURRENCES = {} for c in s: OCCURRENCES[c] = OCCURRENCES.get(c, 0) + 1 avgOC = len(s) // len(OCCURRENCES) print (''.join([c for c in s if OCCURRENCES[c] < avgOC]) ) # equality
...
print ("".join([char for char in mess if char.isalpha()]))