# import urllib2 # import json # opener = urllib2.build_opener() # #f = opener.open('https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=13762096719') # f = opener.open('https://www.baifubao.com/callback?cmd=1059&callback=phone&phone=18637130240') # # # s = '*'+f.read() # # ss = s[s.index('('):] # print ss # #ss = '{"hello":"world","good":"morning"}' # j = json.loads(ss) # print j # encodedjson = json.dumps(s) # print encodedjson # line = '手机:18349299386xyz18349299385' # m = re.findall('1[3|5|7|8|][0-9]{9}',line) # for e in m: # print e filename = "yichen.txt" with open(filename) as f: content = f.read().splitlines() for line in content: print line ps = functions.get_phones(line) for p in ps: print p
strsigline = "".join(strsigline.split()) if strsigline not in siglineset: siglineset.add(strsigline) print strsigline myfile = open(filename, 'a+') myfile.write(strsigline + "\n") myfile.close() # myphone = functions.get_phone(strsigline) # if myphone not in phoneset: # phoneset.add(myphone) # print myphone # thefile = open(file_phone, 'a+') # thefile.write(myphone + "\n") # thefile.close() myphones = functions.get_phones(strsigline) for myphone in myphones: if myphone not in phoneset: phoneset.add(myphone) print myphone thefile = open(file_phone, 'a+') thefile.write(myphone + "\n") thefile.close() # 帖子的其他页 uurls = notesoup.findAll('a', attrs={'href': re.compile('^dispbbs.*')}) if len(uurls): uurls.pop() for u in uurls: otherurl = urlhome + u["href"] print otherurl othernote = ""
# opener = urllib2.build_opener() # #f = opener.open('https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=13762096719') # f = opener.open('https://www.baifubao.com/callback?cmd=1059&callback=phone&phone=18637130240') # # # s = '*'+f.read() # # ss = s[s.index('('):] # print ss # #ss = '{"hello":"world","good":"morning"}' # j = json.loads(ss) # print j # encodedjson = json.dumps(s) # print encodedjson # line = '手机:18349299386xyz18349299385' # m = re.findall('1[3|5|7|8|][0-9]{9}',line) # for e in m: # print e filename = "yichen.txt" with open(filename) as f: content = f.read().splitlines() for line in content: print line ps = functions.get_phones(line) for p in ps: print p