python json转对象,不规则json转excel
列表=new ArrayList (;
公共CSV util () {
}
publiccsvutil (字符串文件名) throws Exception {
this.fileName=fileName;
br=newbufferedreader (新文件读取器)文件名称);
字符串步骤;
while((stemp=br.readline ) )!=空) {
list.add(stemp );
}
}
公共列表获取列表(
返回列表;
}
/rrdxq
公共int get rownum
return list.size (;
}
/rrdxq
公共int get colnum
if (! list.toString ().equals([] ) ) }{
if(list.get(0).toString ).contains )、)和CSV是逗号分隔文件
returnlist.get(0).toString ).split ) ',').length;
}elseif(list.get(0).toString ).trim ).length )!=0}{
返回1;
} else {
返回0;
}
} else {
返回0;
}
}
/rrdxq
公共字符串获取(索引) {
if(this.list.size )!=0}{
return (字符串) list.get )索引;
} else {
返回空值;
}
}
/rrdxq
publicstringgetcol(intindex ) {
if(this.getcolnum ()==0) ) )。
返回空值;
}
StringBuffer sb=new StringBuffer (;
字符串tmp=null;
int colnum=this.getColNum (;
if(colnum1) {
for(iteratorit=list.iterator ); it.hasNext (; () )。
tmp=it.next ().toString );
sb=sb.append(tmp.split (',') [indexzjdmj,' ] )
}
} else {
for(iteratorit=list.iterator ); it.hasNext (; () )。
tmp=it.next ().toString );
sb=sb.append(tmpzzdbbt,';
}
}
stringstr=new string (sb.tostring ();
str=str.substring(0,str.length ) (- 1 );
返回str;
}
/rrdxq
公共字符串获取(int col,int col ) {
字符串temp=null;
int colnum=this.getColNum (;
if(colnum1) {
}elseif(colnum==1) {
} else {
}
返回时间;
}
公共void CSV close () throws Exception{
this.br.close (;
}
/rrdxq
公共字符串移动头(stringstr )。
String[] str_1=str.split (,);
String sb=new String (;
for(intI=1; I