0

I have 112 lines of text file. Now I want to separate into 10 lines each with comma separated from the main text file. The output should be 12 lists (11x10 and last 1x2)

Input text file:

A-123
A-134
A-987
A-064
A-986
A-087
A-546
...

Desired output:

[A-123,A-134,A-987,...]...

code:

with open(r"t.txt",'r') as file:
    files=[next(file) for z in range(10)]
print(files)
Techython
  • 1
  • 1

0 Answers0