Two objects in an expression must be connected by an operator. Object 1: i Object 2: -1

脚本如下

dirPath = "/ssd/ssd0/shenzhen_2020_snapshot/2020"
dirs = exec filename from files(dirPath) order by filename
def cuts(obj, num){
	dir = obj.cut(size(obj) / num);
	len = size(dir);
	if(size(obj) % num != 0){
		for(i in 1..size(dir[len-1])){
			dir[i -1] = dir[i-1] join dir[len-1][i-1];
		}
		dir.pop!();
	}
	return dir;
}
请先 登录 后评论

1 个回答

Yingnan Wang

dir[i -1]这里的变量i有一个空格,会导致把减号和1解析成负一。

解决办法是:去掉变量i后面的空格,或者i - 1

请先 登录 后评论