| 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
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.