Skip to content

Instantly share code, notes, and snippets.

@zhouji
Created November 27, 2012 02:06
Show Gist options
  • Save zhouji/4151941 to your computer and use it in GitHub Desktop.
Save zhouji/4151941 to your computer and use it in GitHub Desktop.
File parse in python
f=open('/home/zhouji/temp/out5','r')
idx=0
ctn=set()
for line in f:
ss=line.split("\001")
s=ss[0]+ss[1]
idx=idx+1
if not s in ctn :
print line.replace("\001","\\001").replace("\002","\\002").replace("\003","\\003")
ctn.add(s)
print ctn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment