I am trying to use a CSV file to store some data. This code creates the file:
with open('keras_character_W.csv', 'w') as csvFile:
fieldnames = ['images', 'result_character']
writer = csv.DictWriter(csvFile, fieldnames=fieldnames)
writer.writeheader()
later, when I am read to store the variables, a command 's' stores them:
state = cv2.waitKey(0)
if state == ord('q'):
break
elif state == ord('s'):
writer.writerow({'images': ' '})
writer.writerow({'images': 'guess_right = ', 'result_character': x, })
writer.writerow({'images': 'final = ', 'result_character': y , })
but the CSV file is empty.
"I checked the caps and if the condition satisfied but didn't find anything the file even open on text editor not excel program "
stateis user input? It’s difficult to understand what’s going, please include all relevant code and data. See: minimal reproducible example.ord()for that, if the input is”s”.