人生苦短,我用 Python
1. 字符串
- 双引号或单引号标示
# 伊洛Yiluo
# https://yiluotalk.com/
>>> account = 'Yiluo'
>>> my_web = 'https://yiluotalk.com/'
- 字符串拼接
>>> account + ' ' + my_web
'Yiluo https://yiluotalk.com/'
\
来去除引号标示字符串的特殊作用
>>> print('I 'm fine')
File "<stdin>", line 1
print('I 'm fine')
^
SyntaxError: invalid syntax
>>> print('I \'m fine')
I 'm fine
>>>
2.字符串索引
- 从左向右,索引从0开始
- 从右向左,索引从-1开始