
When I call a csv file, I want to compare whether the values in a particular column are greater than a particular value. Then, I'd like to put on a pop-up window.
import ctypes
import csv
reader = csv.reader(csv_file_name)
for row in reader:
if(row[3]>=5):
mymessage = 'A message'
title = 'Popup window'
ctypes.windll.user32.MessageBoxA(0, mymessage, title, 0)
else:
continue
To solve this problem, I wrote the code above and there was no response. Here, I want to check if the values in the column are each greater than "5" and show a pop-up window. What part of the code is wrong?
I took a csv with following data:

code worked: on adding int(row[3])>=5
import ctypes
import csv
with open('data.csv') as csv_file:
reader = csv.reader(csv_file)
for row in reader:
if(int(row[3])>=5):
mymessage = 'A message'
title = 'Popup window'
ctypes.windll.user32.MessageBoxA(0, mymessage, title, 0)
else:
continue
result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With