This is my first post.
I recently started Python on my own, so this time I'll list some ** methods for strings **. Hereafter, the character string object to be handled is string.
Converts only the beginning of the string to uppercase
Convert all characters to lowercase so that you can search for strings, ignoring case
Centers the string with the specified number of characters. Fill in the blank with the character string specified by'char'.
Returns the number of times the string contains'search'. In the following code, the character strings are counted so that they do not overlap.
test.py
>>>'aaaaaa'.count('aaa')
2
Check for a match at the end of the string. When the start position and end position are specified, the same rules as the slice operation ((3, -4), etc.) are used.
See Resources for more information.
--References Atsuo Ishimoto: Detailed explanation of Python grammar, O'Reilly Japan, 2014 [From Amazon](http://www.amazon.co.jp/Python%E6%96%87%E6%B3%95%E8%A9%B3%E8%A7%A3-%E7%9F%B3% E6% 9C% AC-% E6% 95% A6% E5% A4% AB / dp / 4873116880 / ref = sr_1_1? S = books & ie = UTF8 & qid = 1455374675 & sr = 1-1 & keywords = python% E6% 96% 87% E6% B3 % 95% E8% A9% B3% E8% A7% A3)
Recommended Posts