I am new into programming. I am seeking help with inserting each row from csv/txt into a new variable in Python.
I have a CSV or TXT file (whichever is simpler to solve this problem) filled with say with IP addresses:
#lines.csv
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
192.168.1.7
I need to read this file and insert each row into a new variable (or into 1 dimensional table). For now I have a working code that reads each row.
import csv
with open("lines.csv") as csvFile: #opens
csvDATA = csv.reader(csvFile, delimiter=',') #reads
for row in csvDATA: #loops
print (row) #prints
csvFile.close()
In another loop later, i will be cURLing each IP address, so if you think there is an easier way to approach this, please share it with me.
Any and all help will be appreciated! Thanks.