学习笔记(2):Python基础入门-Python的字符串知识点讲解

it2026-10-10  1

立即学习:https://edu.csdn.net/course/play/29410/417577?utm_source=blogtoedu

1. "hello world" 或 ' hello world' 单引号或双引号都可包含字符串

2. "hello 'python' wold" 或 'hello "python" world' 双中含单,单中含双

3. 'hello \'python\' wolrd' 单引号含单引号,需要用\转移

4. "hello \"python\" world" 双引号含双引号,需要用\转移

5. """ 或 '''  三个单引号或双引号可包含多行数据

知识点2

6. "abcdef"  子串的获取

str[-1] = 'f'

str[2:4] = "cd"

str[:4] = "abcd"

str[2:] = 'cdef'

str[:] = 'abcdef'

 

 

 

相关资源:小甲鱼《零基础入门学习Python》学习笔记:知识点+课后习题答案(前25课)
最新回复(0)