Skip to content

Commit

Permalink
fix: recognize bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
labbbirder committed Jul 22, 2021
1 parent 1486b2b commit 3387b50
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,25 @@ def Table_String_new(tab,off):
return Table_String(tab,off).decode("utf-8")
Parser.Table.String = Table_String_new

str_types = (str,)
try:
str_types += (bytes,)
except:
pass
try:
str_types += (unicode,)
except:
pass

def normalizeResult(result):
if isinstance(result,(str,bytes,unicode)):

if isinstance(result,str_types):
return result
if isinstance(result,float):
result = "%f"%result
if "." in result:
return result.rstrip("0").rstrip(".")
return str(result)
return str(result)

def writeFile(text):
Expand Down

0 comments on commit 3387b50

Please sign in to comment.