0
Good morning. I have to read a field(line) from a file in . csv and fill in a certain field on the system. How should I do? Example, man . csv is the mass of data for filling in a register.
0
Good morning. I have to read a field(line) from a file in . csv and fill in a certain field on the system. How should I do? Example, man . csv is the mass of data for filling in a register.
0
You can do it in various ways, but the most usual is:
import csv
with open('214385.csv') as f:
f_csv = csv.reader(f)
headers = next(f_csv)
for row in f_csv:
# Process row
print(row)
link: https://github.com/weltonvaz/stackoverflow/blob/master/214385.py
Example of csv file:
Obs: the first row and header
Symbol,Price,Date,Time,Change,Volume
"AA",39.48,"6/11/2007","9:36am",-0.18,181800
"AIG",71.38,"6/11/2007","9:36am",-0.15,195500
"AXP",62.58,"6/11/2007","9:36am",-0.46,935000
"BA",98.31,"6/11/2007","9:36am",+0.12,104800
"C",53.08,"6/11/2007","9:36am",-0.25,360900
"CAT",78.29,"6/11/2007","9:36am",-0.23,225400
link: https://github.com/weltonvaz/stackoverflow/blob/master/214385.csv
this example was taken from the book: Python Cookbook --> http://chimera.labs.oreilly.com/books/1230000000393/ch06.html#_solution_94
Welton, good afternoon. Thank you in your reply. I have the following code: Click("132356.png") type("Here I have to put the .csv info") How to make this art?
I don’t understand, you could explain better.
Browser other questions tagged python csv integration
You are not signed in. Login or sign up in order to post.
Related: CSV file reading and data storage in a vector
– Jefferson Quesado
Also read How to read a CSV file in Python?
– Jefferson Quesado