标签:split line har log env bsp char lines 字符
#!/usr/bin/env python def wordCount(s): chars = len(s) words = len(s.split()) lines = s.count(‘\n‘) print lines, words, chars s = open(‘/etc/passwd‘).read() wordCount(s)
标签:split line har log env bsp char lines 字符
原文地址:http://www.cnblogs.com/pzk7788/p/6784599.html