首页 > 编程语言 > 详细

多维数组的字符依次输出,用pytho实现

时间:2017-07-03 11:16:50      阅读:214      评论:0      收藏:0      [点我收藏+]

#-*- coding=utf-8 -*-
listm=["s","l","z","x","l","m","XX",[123,23,4,89,05,[78,35,65,2017],"zX",1.2],2.3,4.5,6.7,8.9,120.23,34.45]
int_num=0
float_num=0
letter_num=0
for i in listm:
if isinstance(i,list):
for j in i:
if isinstance(j,list):
for m in j:
if isinstance(m,int):
int_num+=1
elif isinstance(m,float):
float+=1
elif isinstance(m,str):
letter_num+=1
elif isinstance(j,int):
int_num+=1
elif isinstance(j,float):
float_num+=1
elif isinstance(j,str):
letter_num+=1
elif isinstance(i,int):
int_num+=1
elif isinstance(i,float):
float_num+=1
elif isinstance(i,str):
letter_num+=1
print int_num
print float_num
print letter_num

输出:

9
7
8
>>>

多维数组的字符依次输出,用pytho实现

原文:http://www.cnblogs.com/zqq521/p/7109759.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!