Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read all available data from file handle and return (with optional timeout)
def read(fh, timeout=0):
output = []
while select.select([fh], [], [], timeout)[0]:
output.append(fh.read(1))
return ''.join(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.