|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
def count(string):
num='0123456789'
en='abcdefghigklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM'
space=[' ']
a,b,c,d=0,0,0,0------------------这个不对
list1=list(string)
for each in list1:
if(each in num):
b=b+1,
elif each in en:
a=a+1
elif each in space:
c=c+1
else:
d=d+1
print('字符串共有:英文字母',a,'个,数字',b,'个,空格',c,'个,其他字符',d,'个。')
TypeError: can only concatenate tuple (not "int") to tuple 报错告诉我说啥元组里没有整形??? 有逗号就变元组,怎么破
for each in list1:
if(each in num):
b=b+1,
|
|