Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jjgod
Forked from anonymous/gist:134329
Created June 23, 2009 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjgod/134333 to your computer and use it in GitHub Desktop.
Save jjgod/134333 to your computer and use it in GitHub Desktop.
try:
inf2 = open(fname, "r")
for line in inf2:
cols = line.split()
#print line
if(len(cols)>=3):
if(cols[2]=="1"): continue
url = cols[0]
#print "original url = "+url
url = url.replace(".", "/")
if url[-1]=="/": url=url[:-1]
urlparts = url.split("/")
partsno =len(urlparts)
#prepare each pars for re operation
...
inf2.close()
except IOError:
print "The file does not exist, goto the next file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment