rclkar/python3: small simplifications

This commit is contained in:
Jean-Francois Dockes 2018-03-08 20:37:34 +01:00
parent d9afcdf8a3
commit b8fa3005dd
2 changed files with 3 additions and 6 deletions

View File

@ -43,14 +43,12 @@ htmltemplate = '''
</html> </html>
''' '''
nlbytes = b'\n'
bsbytes = b'\\'
PY3 = sys.version > '3' PY3 = sys.version > '3'
if PY3: if PY3:
nlbytes = bytes('\n', encoding='iso-8859-1')
bsbytes = bytes('\\', encoding='iso-8859-1')
nullchar = 0 nullchar = 0
else: else:
nlbytes = '\n'
bsbytes = '\\'
nullchar = chr(0) nullchar = chr(0)
class KarTextExtractor: class KarTextExtractor:

View File

@ -39,8 +39,7 @@ if PY3:
def next_byte_as_int(data): def next_byte_as_int(data):
return next(data) return next(data)
def next_byte_as_char(data): def next_byte_as_char(data):
ret = bytes([next(data)]) return bytes([next(data)])
return ret
else: else:
def next_byte_as_int(data): def next_byte_as_int(data):
return ord(data.next()) return ord(data.next())