python语言学习-------------------------------------csv模块将有规律的分隔符去掉,转成一列数据(常用)
上代码:
import csv
f = open("C:/Users/Administrator/Desktop/11.txt",'r')
with f:
reader = csv.reader(f,delimiter=",")
for row in reader:
for e in row:
print(e)
实现效果如下:
G:\Python3.8解释器\python.exe C:/Users/Administrator/PycharmProjects/pythonProject/11.py
192.168.1.1
192.168.3.1
192.168.33.2
172.1.2.22
178.3.21.124
168.131.35.11
168.131.35.12
168.131.35.13
168.131.35.14
168.131.35.15
Process finished with exit code 0