Python - 字符串为多行时,转换为列表

例如一个IP代理池,这是个字符串,有多行
120.236.137.65:8060
193.112.208.216:8118
121.8.98.198:80
121.8.98.197:80
121.8.98.196:80
120.236.168.19:8060
123.207.6.117:80

import requests

resp = requests.get(GET_IP_API)

text = resp.text
print(text)

to_one_line = ' '.join(text.split())
IP_LIST = a.split(' ')

print(IP_LIST)

猜你喜欢

转载自www.cnblogs.com/allen2333/p/9557746.html