A Python unicode object. That is, an instance of str.
8.9. PyStr
opaque
Creates a Python string from a Lean string.
opaque
Returns the UTF8-encoded value of self as a Lean String.
If the string contains lone surrogates (and is thus not valid UTF-8),
they will be replaced with � (U+FFFD, the official Unicode replacement
character), following Lean's standard lossy encoding.
8.9.1. Encoding to bytes
opaque
Nerodia.PyStr.encode (self : PyStr) (encoding : CodecEncoding) (errors : CodecErrors := CodecErrors.strict) : CPyIO PyBytesNerodia.PyStr.encode (self : PyStr) (encoding : CodecEncoding) (errors : CodecErrors := CodecErrors.strict) : CPyIO PyBytes
Returns the string encoded as bytes.
This is equivalent to the Python str.encode(self, encoding, errors).
def
Returns the UTF-8-encoded value of the string as bytes.
This is equivalent to self.encode .utf8 .strict but more efficient.