Skip to content

Commit

Permalink
correct rounding in percentage formating
Browse files Browse the repository at this point in the history
  • Loading branch information
dilshod committed Apr 15, 2015
1 parent 4a9ba81 commit 97a0101
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xlsx2csv.py
Expand Up @@ -628,7 +628,7 @@ def handleCharData(self, data):
elif format_type == 'float' and ('E' in self.data or 'e' in self.data):
self.data = ("%f" %(float(self.data))).rstrip('0').rstrip('.')
elif format_type == 'float' and format[0:3] == '0.0':
self.data = ("%." + str(len(format.split(".")[1])) + "f") % float(self.data)
self.data = ("%." + str(len(format.split(".")[1])+(1 if ('%' in format) else 0)) + "f") % float(self.data)

except (ValueError, OverflowError):
# invalid date format
Expand Down

0 comments on commit 97a0101

Please sign in to comment.