Hello_World!/애플추가_파이썬

[자작쉘] http URL 긁어오기

bitfox 2011. 8. 8. 16:03

#http://docs.python.org/howto/regex.html
#해당 서비스 URL을 긁어와야 하는데 넘 귀찮아 우리 파썬이를 이용해봤다.
#매우 단순~ 코드.. 하지만 모르면 어렵다는거 =ㅅ=;
import re, time
import httplib, string

print "====================="
f=open("url.html",'r')
line=f.readline()
print "Scan URL! ==========="
for line in f:
 ad = re.findall('http.*?\'',line)
 if ad:
  print "Success is  %s" %ad
  e = open("Url_list.txt", 'a')
  data = str(ad) + '\n'
  e.write(data)
  e.close()
 else:
  print "URL is not found"
# time.sleep(0.5)