大家讲道理2017-04-18 10:29:39
s[:-1]
will only slice to the penultimate element
[start:stop]
中會切出 start
到 stop-1
.
大家讲道理2017-04-18 10:29:39
All intervals in python are closed on the left and open on the right [m,n)
天蓬老师2017-04-18 10:29:39
-1 is the last element,
If you don’t want to remove the leading and trailing spaces, should you use strip()