vendredi 30 novembre 2018

TypeError: bad operand type for unary +: 'unicode' python concatenation

I am trying to use a print statement to print out certain elements. I keep facing a TypeError when doing so. The error shows :

File "data.py", line 58, in main
print ("Current file_size" , + data_current['File Name'], "does not match previous file_size" , + data_previous['File Name'])

TypeError: bad operand type for unary +: 'unicode' My code is as follows :

if data_current['File Name'] == data_previous['File Name']:  # If file names match

   if data_current['File Size'] != data_previous['File Size']: # If file sizes do not match
                data_current = json.loads(cd)
                data_previous = json.loads(pd)
                print ("Current file_size" , + data_current['File Name'], "does not match previous file_size" , + data_previous['File Name'])

Aucun commentaire:

Enregistrer un commentaire