例如,我有一个原始的pastebin:https : //pastebin.com/raw/YsgHMTkZ,例如:
word1
word2
word3
word4
word5
word6
...
我只想将它们放在这样的变量中:
keyword_name = [“ word1”,“ word2”,“ word3”,“ word4”,“ word5”,“ word6”,“ ...”]
谢谢,祝你有美好的一天。
使用发送GET
请求requests
,检索内容,并用空格分开。然后split
将已经为您返回列表。
import requests
resp = requests.get('https://pastebin.com/raw/YsgHMTkZ')
result = resp.text.split()
print(result)
# ['word1', 'word2', 'word3', 'word4', 'word5', 'word6', '...']
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句