This example shows how to display the first character of a Python® str
variable. The example compares indexing into a MATLAB® character vector with indexing into the Python variable.
Create a MATLAB character vector and display the first character.
str = 'myfile';
str(1)
ans = char m
Convert the character vector to a Python str
type and display the first character.
pstr = py.str(str); pstr(1)
ans = Python str with no properties. m