py_repr | R Documentation |
This is equivalent to calling str(object)
or repr(object)
in Python.
py_repr(object)
py_str(object, ...)
object |
Python object |
... |
Unused |
In Python, calling print()
invokes the builtin str()
, while auto-printing
an object at the REPL invokes the builtin repr()
.
In R, the default print method for python objects invokes py_repr()
, and
the default format()
and as.character()
methods invoke py_str()
.
For historical reasons, py_str()
is also an R S3 method that allows R
authors to customize the the string representation of a Python object from R.
New code is recommended to provide a format()
and/or print()
S3 R method
for python objects instead.
The default implementation will call PyObject_Str
on the object.
Character vector
as.character.python.builtin.str()
as.character.python.builtin.bytes()
for handling
Error : Embedded NUL in string.
if the Python string contains an embedded NUL
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.