怎样把java运行的改成pycharm运行的(萌新求助)
pycharm吧
全部回复
仅看楼主
level 1
var str="Never give up, Never lose hope. Always have faith, It allows you to cope. Trying times will pass, As they always do. Just have patience, Your dreams will come true. So put on a smile, You'll live through your pain. Know it will pass, And strength you will gain";
lines=0,sum=0;
strs=str.split(",");
for (var i=0;i<strs.length;i++) {
var trs1=strs[i].split(".");
lines+=trs1.length;
for(var j=0;j<trs1.length;j++){
var trs2=trs1[j].trim().split(/\s+/);
sum+=trs2.length;
}
}
console.log("行数:"+lines,"单词数:"+sum)
2019年03月12日 08点03分 1
1