当前位置: 代码迷 >> 综合 >> python 常用知识点
  详细解决方案

python 常用知识点

热度:10   发布时间:2024-03-06 07:09:10.0

1.遍历列表提取下标和值:

for index,value in enumerate(['apple', 'oppo', 'vivo']):
        print(index,value)

2.bytes 和 str 的互相转换

字符串转bytes:str.encode('utf-8')

bytes转字符串:bytes.decode('utf-8')

  相关解决方案