len()内建函数:计算字符串的长度。
语法格式:len(string)
示例代码
str1 = "hello" print(len(str1))
len获取长度
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ # Author:shichao # File: .py str1 = "hello" print(len(str1))