统计“zifuchuan我是个程序ii”中中文的个数
#!/usr/bin python#encoding:utf8def main(): str = "zifuchuan我是个程序ii" sum = 0 for i in range(len(str.decode('utf-8'))): if str.decode('utf-8')[i]<='z': continue else: sum+=1 print sumif __name__ == "__main__": main()~
有别的什么好方法请不吝赐教 初学者