In this article we mainly study the method of finding the length of a string in Python--__len__ () Whether it is two-dimensional or one-dimensional, and its simple
Learn Python by topic:
Returns the length of the last word, given a string consisting of uppercase, lowercase letters, and spaces.
If the word does not exist in the input, 0 0 is returned.
Attention:
"word" refers to a string that does not contain a space symbol
For example:
For a string "hello World" (without quotation marks), the returned result is 55;
For "abc abc " a string (without the quotation marks), the returned result is 33.
Input format
Enter only one row for the string ss (length not exceeding 1000010000).
Output format
The length of the last word in the output s S.
Sample Input 1
Today is a nice day
Sample Output 1
3
Sample Input 2
The quick brown fox jumps over the lazy dog
Sample Output 2
3
It is just the length of the last word, two times the length is good.
3.5 #-*--coding:-utf8--*-x=input (). Split () len=x.__len__ ()if len==0 : print (0)else: y=x[len-1] print (y.__len__ ())
The path to learning in Python--10 basic articles