Linux 拨号vps windows公众号手机端

python怎么判断字符串长度

lewis 9年前 (2016-12-16) 阅读数 8 #程序编程
文章标签 python

可以使用len()函数来判断字符串的长度,示例如下:

string = "Hello, World!"
length = len(string)
print("The length of the string is:", length)

输出结果为:

The length of the string is: 13
版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门