网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

怎样在 Python 求一个字符串的长度

时间:2024-10-11 20:40:14

1、首先,右键点击【项目】,创建一个【Python】文件

怎样在 Python 求一个字符串的长度

3、然后,复制代码粘贴到文件中if __name__ == '__main__': s = raw_input('please input a string:\n') print 'the string has %d characters.' % len(s)

怎样在 Python 求一个字符串的长度

5、最后,在最下面就可以看到运行结果了

怎样在 Python 求一个字符串的长度
© 海能知识库