J
Joan Miller
Does `raw_input` uses internally `sys.stdout.write`?
Joan said:Does `raw_input` uses internally `sys.stdout.write`?
Joan said:Does `raw_input` uses internally `sys.stdout.write`?
You can test this yourself without reading the C source:
Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.>>> import sys
... def write(self, s):
... sys.__stdout__.write(s.upper())
...>>> sys.stdout = A()
FOObar
'BAR'
Peter
It was to display the output inside a GUI app. overriding
`sys.stdout`. And as `print` also uses internally `sys.stdout.write`
then can be used `print` the shell script and get the output too in
the GUI, cann't it?
Shashwat said:raw_input uses sys.stderr I guess ?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.