Find element '0' in each rwo of CSV file in Python -


what i'm trying should simple,to write program reads csv or txt file line line , finds rows have more 1 element equal 0 highlighting these lines , saving new version of highlighted csv file. have csv file this:

enter image description here

i have no idea how find elements = 0 in each row of csv file , how change color of row. don know if there way save copy of changed csv file.

if self.enablecalibration.ischecked():     try:         importedfile = open('some.csv', 'rb')         csvreading= importedfile.read(_max_lunghezza_file)         lenght_csvreading = len(csvreading)         csvfilearray = []         row in csv.reader(importedfile, delimiter=' '):             csvfilearray.append(row)             if two_elements == 0: ?                highlight_row? # not string or python command                csvfilearray.next() # go next row             if csvreading.split(-1): # end of csv file                   csvsave= csv.writer(csvreading)  #to save                     importedfile.close()         else:     csvreading = none     lenght_csvreading = 0 

maybe variable two_elements string, code:

if two_elements == 0: ? 

is comparing "0" == 0: ? ->false

try cast:

if int(two_elements) == 0: 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -