求大神把这段JAVA代码改成Python 50
Filefscan=newFile(ioparm.f_input);Scannerinput=newScanner(fscan);Stringline;while((li...
File fscan=new File(ioparm.f_input);
Scanner input=new Scanner(fscan);
String line;
while ((line=input.nextLine())!=null) { // read friendship pair (s,f)
if(line.equals("END")){
break;
}
String[] se=line.split("\t");
s=Integer.parseInt(se[0]);
f=Integer.parseInt(se[1]);
//w=Integer.parseInt(se[2]);
numlinks++; // count number of edges
if (f < s) { t = s; s = f; f = t; } // guarantee s < f
if (f > numnodes) { numnodes = f; } // track largest node index
if (t2-t1>ioparm.timer) { // check timer; if necessarsy, display
System.out.println(" edgecount: ["+numlinks+"]");
t1 = t2; //
ioparm.timerFlag = true; //
} //
}
input.close(); 展开
Scanner input=new Scanner(fscan);
String line;
while ((line=input.nextLine())!=null) { // read friendship pair (s,f)
if(line.equals("END")){
break;
}
String[] se=line.split("\t");
s=Integer.parseInt(se[0]);
f=Integer.parseInt(se[1]);
//w=Integer.parseInt(se[2]);
numlinks++; // count number of edges
if (f < s) { t = s; s = f; f = t; } // guarantee s < f
if (f > numnodes) { numnodes = f; } // track largest node index
if (t2-t1>ioparm.timer) { // check timer; if necessarsy, display
System.out.println(" edgecount: ["+numlinks+"]");
t1 = t2; //
ioparm.timerFlag = true; //
} //
}
input.close(); 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询