Python 操练 实例70标题 :写一个函数,求一个字符串的长度,在main函数中输进 字符串,并输出其长度。 法式 剖析 :无。 法式 源代码: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': s = raw_input('please input a string:n') print 'the string has %d characters.' % len(s) 以上实例输出成果 为: please input a string: abc the string has 3 characters. |
请发表评论