例7.用户从键盘输入一行字符,编写一个程序,统计并输出其中的英文字符(包括中文字符).数字.空格和其他字符个数. #字符数统计.py Str = input('请输入一行字符:') alpha = 0 space = 0 num = 0 other = 0 for i in Str: if i.isalpha(): alpha += 1 elif i.isspace(): space += 1 elif i.isnumeric(): num += 1 else : other += 1 prin…
这里主要考虑的是日文,日文中包含了半角和全角文字,半角算1,全角算2. <html> <head> <script language="javascript"> function alertLength() { var name = document.main.name.value; window.alert("入力文字:[" + name + "]"); var length = countLength(na…