FAQ

Am 02.05.15 um 21:57 schrieb Adam Barto?:
Even if sys.stdin contained a file-like object with proper encoding
attribute, it wouldn't work since sys.stdin has to be instance of <type
'file'>. So the question is, whether it is possible to make a file instance
in Python that is also customizable so it may call my code. For the first
thing, how to change the value of encoding attribute of a file object.

If, by "in Python", you mean both "in pure Python", and "in Python 2",
then the answer is no. If you can add arbitrary C code, then you might
be able to hack your C library's stdio implementation to delegate fread
calls to your code.


I recommend to use Python 3 instead.


Regards,
Martin

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 18 of 24 | next ›
Discussion Overview
grouppython-dev @
categoriespython
postedApr 28, '15 at 8:20p
activeMay 12, '15 at 3:59a
posts24
users10
websitepython.org

People

Translate

site design / logo © 2017 Grokbase