I have a file, the content is in the format of
41545 0 0 1 2 3 3 3 ...
Following is the code
X= Y= total=0 count=0 for line in open(file,'r'): count+=1 line=line.strip() if(line.strip()): if(count==1): total=int(line) else: X.append(count-1) Y.append(int(line))
the output for the above code is
total=41545 #first line X=[1,2,3,4,5,6,7] #count of second line onwards Y=[0,0,1,2,3,3,3] #second line onwards information
Is there a shorter and hopefully more efficient code that can achieve the same purpose?