可怜的猪头 阅读(225) 评论(0)
[root@localhost /]# cat key.py
#!/bin/python
from random import *
import re
from collections import Counter
a=[randint(1,15) for _ in range(20)]
b=dict.fromkeys(a,0)
for i in b:
    b[i]+=1
e=[(k,v) for k,v in b.items()]
print(sorted(e))
c=Counter(a)
d=c.most_common(3)
print a
print b
print d

txt=open('/etc/hostapd.conf').read()
print txt
spl=re.split('\W+',txt)
print spl
haha=Counter(spl)
print (haha.most_common(3))

[root@localhost /]#