我的问题是我正在尝试在搜索中找到通配符,因为每个输入的答案可能不同。
以下是代码:
ContactsContract.Contacts
问题是我正在创建的脚本找不到翻译后的单词,因为它们在html代码中显然不止一个import urllib.request, re, fnmatch
while True:
word = input('Enter your word: ')
url = 'http://www.spanishdict.com/translate/' + word
u = urllib.request.urlopen(url).read()
decoded = u.decode('utf-8')
search_1 = re.search('<span class="context">', decoded)
search_2 = re.search('</span> ', decoded)
start = search_1.end()
end = search_2.start()
final = decoded[start:end]
search_3 = re.search('<a href="/translate/', decoded)
search_4 = re.search('</a>', decoded)
start_2 = search_3.end()
end_2 = search_4.start()
final_2 = decoded[start_2:end_2]
print(final)
print(regex)
。