Krollibrius Krollibrius - 1 year ago 247
Python Question

Python: How can I print bytes?

I'm using Python 2.7.

I want to print a binary in decimal, but I'm receiving an error, which I do not understand.

Eg. I am trying:

print 0b111

I am expecting 7. But it returns:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
Error: no "print" mailcap rules found for type "text/x-python"

Can you help? Just a beginner with Python!

Answer Source

... at /usr/bin/print ...

Sounds like you're invoking the script incorrectly. Either use a shebang that points to a Python executable or explicitly pass it to the executable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download