去除重复行
1.
print(''.join(set([x for x in open('cn.txt').readlines() if re.search(r'X.509',x,re.I)])))
2.
print (''.join(set([x for x in open('cn.txt').readlines() if x.strip()!=''])))
3.
print (''.join(set(open('cn.txt').read().split('\n'))))
截取第二列:
1.
m=''.join(set([x for x in open('cn.txt').readlines() if re.search(r'X.509',x,re.I)]))
print(m.split(',')[1])
CN=ippan
2.
print(''.join(set([x for x in open('cn.txt').readlines() if re.search(r'X.509',x,re.I)])).split(',')[1])