字符串
>>> a = 'hello'
>>> b = 'what\'s up'
>>> c = "what's up"
>>> print(a)
hello
>>> print(b)
what's up
>>> print(c)
what's up
>>> s = 'hello'
>>> print(s[0])
h
>>> print(s[1])
e
>>> s = 'hello'
>>> print(s[0:3]) # 切片的规则:s[start:end:step] 从start开始到end-1结束,步长:step
hel
>>> print(s[0:4:2])
hl
#显示所有字符
>>> print(s[:])
hello
#显示前3个字符
>>> print(s[:3])
hel
#对字符串倒叙输出
>>> print(s[::-1])
olleh
#除了第一个字符以外,其他全部显示
>>> print(s[1:])
ello
>>> s = 'hello'
>>> print(s * 5)
hellohellohellohellohello
>>> s = 'hello'
>>> print(s + 'world')
helloworld
>>> s = 'hello'
>>> print('h' in s)
True
>>> print('w' in s)
False
>>> s = 'hello'
>>> for i in s:
... print(i)
...
h
e
l
l
o


