python常用方法

字符串

1
2
3
4
5
6
7
8
9
10
11
12
13
name = 'hello world'
name.title()
# Hello World
name.upper()
# HELLO WORLD
name.lower()
# hello world
'hello '.rstrip()
# hello 右边空格
' hello'.lstrip()
# 左边空格
' hello '.strip()
# 两边空格