# Data processing dataset yes 30 A list of samples a = data.split(',')dataset = [(int(a[i]), int(a[i+1]),int(a[i+2]),int(a[i+3]),int(a[i+4]), int(a[i+5]),......) for i in range(1, len(a)-1, 20)]# Up to int(a[i+44]), I just wrote i+5, It's too much trouble to keep writing , Is there any loop structure that can be implemented ?
Double loop write can be used to write in the list parsing formula , Example :
data='100,20,231,351,333,223,13,78,88,98,139,76'.split(',')dataset=[[int(data[i+j]) for j in range(3)]for i in range(0,len(data),3)]print(dataset)