Skip to main content

cout & cerr like in C++

Project description

cout & cerr like in C++

Usge:

from stdcpp import cout, cerr, endl

cout << "Hello" << " " << "world!" << endl
cerr << "Hello" << " " << "world!" << endl

Bonus 1:

from stdcpp import Stream

s = Stream('log.txt', 'a+')
s << "Hello "
s.close()

with Stream('log.txt', 'a+') as s:
    s << "world!" << endl

Bonus 2:

import io
from stdcpp import Stream, cout

ios = io.StringIO()
s = Stream(ios)
s << "Hello world!" << endl
ios.seek(0)
cout << ios.read()

Bonus 3:

from stdcpp import coutln, cerrln

coutln << "Hello world!"
cerrln << "Hello world!"

Bonus 4:

from stdcpp import cdbg

x = 123
y = 'foobar'

cdbg << x << y

result:

x: int = 123
y: str = 'foobar'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stdcpp-0.5.0.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

stdcpp-0.5.0-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page