Mercurial > touhou
view pytouhou/utils/helpers.py @ 23:444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 12 Aug 2011 19:13:43 +0200 |
parents | 6b2c7af2384c |
children | ab826bc29aa2 |
line wrap: on
line source
def read_string(file, size, encoding=None): data = file.read(size) try: data = data[:data.index(b'\x00')] except ValueError: pass if encoding: return data.decode(encoding) else: return data