>>> "aaa".capitalize()
'Aaa'
>>> "Hi, Mac, Hello".casefold()
'hi, mac, hello'
>>> "123".center(6)
' 123 '
>>> print("123".center(6))
123
>>> print("123".center(10,"z"))
zzz123zzzz
>>> str="I love Python. Python is a programming language"
>>> str.count("Python")
2
>>> text="Python is easy to learn."
>>> text.endswith('to learn.')
True
>>> str='xyz\t1234\tzzz\t45'
>>> str.expandtabs()
'xyz 1234 zzz 45'
>>> str="Let me test this string"
>>> str.find("test")
7
>>> str.find("that")
-1
>>> print("Hello {}, my fav no is {}.".format("Tom", 888))
Hello Tom, my fav no is 888.
コメント
コメントを投稿