Does anyone of you has use strings methods on your code?
I'm trying to use the following:
Code: Select all
str.center(width, fillchar)
str.ljust(width, fillchar)
str.rjust(width, fillchar)
str.title()
Code: Select all
MicroPython v1.9.2-8-gbf8f45cf on 2017-08-23; ESP module with ESP8266
Type "help()" for more information.
>>> a = "pepito"
>>> a.center(10,"*")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'center'
>>> a.rjust(10,"*")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'rjust'
>>> a.ljust(10,"*")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'ljust'
>>> a.title()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'title'
>>> b = a.title()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'title'
>>>
Note: I have looked at the documentation but no reference to those.
http://docs.micropython.org/en/latest/p ... ltins.html
Regards.
UPDATE
I got it to work with
Code: Select all
.format
Code: Select all
a = "hola"
print('{:*^10}'.format(a))