Python 五大内置数据结构 str /list/tuple /dict/set
1. str 字符串 特性:有序、不可变序列,支持索引、切片s "hello"遍历# 1.直接遍历字符
for c in s:print(c)
# 2.下标遍历
for i in range(len(s)):print(i, s[i])
# 3.下标字符
for idx, char in enumerate(s):print(idx, char)基础运算s1 s…
2026/7/22 3:34:13