Just learn python, try to find an example to try.
The code is as follows |
Copy Code |
#!/usr/bin/env python #coding =utf-8 Import Sys Import Urllib2 Import string Import re Import OS Demo = "" " """ Try If Len (SYS.ARGV) < 2: Print "----------------------------------------" Print Demo Print "----------------------------------------" Sys.exit () LJ = "/?author=" url = sys.argv[1] + LJ Path = OS.GETCWD () #获取文件路径 Url_name = Re.findall (' http://(. *\w) ', sys.argv[1]) #获取域名 Url_name_txt = url_name[0] + '. txt ' Print "Username to%s\\%s"% (path,url_name_txt) For I in Xrange (1,1111): #循环ID web = URL + str (i) Code = Urllib2.urlopen (Web). Read () #获取源码 Username = Re.findall (' <title> (. *\w) | ', code) #正则匹配用户名 username_txt = open (str (url_name_txt), ' a ') Username_txt.writelines (username) Username_txt.writelines ("\ n") Username_txt.close () Except print ' Just for wp.py ' |
Effect Chart: