1 | initial version |
You can make a conversion:
sage: b = ascii_to_bin('Hi')[4]
sage: b
1
Unfortunately, there is no direct convertion to ZZ
:
sage: ZZ(b)
TypeError: unable to coerce <class 'sage.monoids.string_monoid_element.StringMonoidElement'> to an integer
but you can first make b
a string an then an integer:
sage: a = ZZ(str(b)) ; a
1
sage: a.parent()
Integer Ring
2 | No.2 Revision |
You can make a conversion:
sage: b = ascii_to_bin('Hi')[4]
sage: b
1
Unfortunately, there is no direct convertion conversion to ZZ
:
sage: ZZ(b)
TypeError: unable to coerce <class 'sage.monoids.string_monoid_element.StringMonoidElement'> to an integer
but you can first make b
a string an then an integer:
sage: a = ZZ(str(b)) ; a
1
sage: a.parent()
Integer Ring