def urls_into_redis(self, url_list): B = redis_or.Redis_Data() if url_list: for i in url_list: try: B.set_into_data("shenzhen_aodi", "http://" + i) except: print("进Redis数据库异常", i) continue else: print("空列表")
def urls_into_redis(self, url_list, city): B = redis_or.Redis_Data() if url_list: for i in url_list: # pattern = re.compile(r'%s/(.*?)/$'%self.city) # key_name = re.findall(pattern,i) # print(key_name) try: B.set_into_data("%s_youxin" % city, i) except: print("进Redis数据库异常", i) continue else: print("空列表")
import sys sys.path.append("..") import redis_or #导入模块的姿势 A = redis_or.Redis_Data() f = open("md5_test.txt", "w") for i in range(9000): f.write(A.pop_data("quanzhou_youxin") + "\n") f.close()