—— 如果需要将数据存储到文件,为了数据的可读性,可以按行写入。常用的文件类型:txt、csv、Excel
文本文件的写入和读取
例子:
import json
"""字符串写入"""
for i in range(10):
with open('a.txt', 'a') as file:
file.write(str(i)+'\n')
"""字典或列表转换成json写入"""
ips = [
{
"https": "https:116.208.48.141:61234"},
{
"https": "https:113.120.32.64:9999"},
{
"https": "https:110.86.139.150:9999"},
{
"https": "https:175.153.21.87:61234"},
{
"https": "https:124.135.120.48:61234"},
{
"https": "https:183.166.137.237:61234"},
{
"https": "https:218.22.7.62:53281"},
{
"https": "https:171.221.203.130:10184"},
{
"https": "https:113.120.32.64:9999"},
{
"https": "https:140.143.48.49:1080"},
{
"https": "https:61.128.208.94:3128"},
{
"https": "https:122.136.212.132:53281"},
{
"https"