Reputation: 15
I would like to build a python3 script that will download a CSV file every day and send it to me by mail. I have managed to download the file and sending the mail. The problem is the filtering. The CSV file contains
"155;03155;Northeim;1669;1261.7;9;35;0;131.55;66;49.9"
and I want to filter only the last value 49.9
and send it to me by mail. This Value changes daily. But the order of the values doesn't.
Can someone help me?
Upvotes: 0
Views: 200
Reputation: 6234
If your CSV file only contains 1 row then read the file, split at ;
and access the last element of the list using [-1]
.
with open('your_csv_file.csv') as fp:
value = fp.read().split(';')[-1]
Upvotes: 1