Can anyone tell me how to write ostream objects in Python so i can do something like cout << x << " and " << y << endl in Python?Can anyone tell me how to write ostream objects in Python so i can do something like cout << x << " and " << y << endl in Python?@Computer Science
I'm still waiting for anybody's solution :-D
print x, 'and', y Don't know python but this seems to work with the ideone.com compiler: http://ideone.com/kDY0e
If you mean coding an output stream module, you have to use a decorator class to avoid basic errors, like trying to write in cStringIO or the famous Unicode error. Check this example: http://ginstrom.com/scribbles/2007/09/14/encoding-an-output-stream-in-python/ Hopefully, that's what you meant by your question.
Join our real-time social learning platform and learn together with your friends!