我想在mongodb中保存正则表达式列表。
但是保存值'\'
时,值会自动删除。
例如; "val":/55\sA\.?B\.?C\.?\s/
"val":/5sA.?B.?C.?s/
答案 0 :(得分:0)
您需要使用import requests
from itertools import permutations
letters = 'BZmO8H'
letter_list = 'abcdefghijklmnopqrstuvwxyz1234567890'
for letter in letter_list:
new_list = letters+letter
print(new_list)
for per in permutations(new_list, 7):
link = ''.join(per)
print(link)
r = requests.head("http://imgur.com/{}".format(link))
print(r.status_code)
if r.status_code == 200:
file = open('links.txt', 'a')
file.write("www.imgur.com/gallery/{}\n".format(link))
file.close()
print("Image Found. Added to File")
elif r.status_code == 404:
print("No Image")
else:
print("ERROR, SOMETHING WENT WRONG")
转义角色。例如,如果您尝试添加?字符,则需要执行\
之类的操作。
我希望我的回答很有帮助。