分行文本

division of text in lines

你好,谢谢你的帮助我需要帮助

我有这个代码 他读了 5-10 行,但我需要重新制作它

f=open("input.txt", encoding='utf-8')
lines=f.readlines()
for x in range(5,10):
    print(lines[x])

我正在寻找这个输出

第一个输入第二个是输出图像

输入

    1-100 lines

我在列表中搜索这个号码

xx = lambda n:n and list(range(n,100,9))

print(xx(num))

输出行是文本

[1, 11, 21, 31, 41, 51, 61, 71, 81, 91]
[2, 12, 22, 32, 42, 52, 62, 72, 82, 92]
[3, 13, 23, 33, 43, 53, 63, 73, 83, 93]
[4, 14, 24, 34, 44, 54, 64, 74, 84, 94]
[5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
[6, 16, 26, 36, 46, 56, 66, 76, 86, 96]
[7, 17, 27, 37, 47, 57, 67, 77, 87, 97]
[8, 18, 28, 38, 48, 58, 68, 78, 88, 98]
[8, 18, 28, 38, 48, 58, 68, 78, 88, 98]
[9, 19, 29, 39, 49, 59, 69, 79, 89, 99]
[10, 20, 30, 40, 50, 60, 70, 80, 90,100]

做一个正方形就可以了

从 1 到 10 从 11 到 20 等等...

线条上有文字,例如,所有 10 个文字合并为一个

[1, 11, 21, 31, 41, 51, 61, 71, 81, 91]

这只是一个例子我有一个33000行的长文本

列表索引加10得到后面10行的行内容。

with open("input.txt", encoding='utf-8') as f:
    lines = [line.rstrip() for line in f.readlines()]
lines = [line.rstrip() for line in lines]
for i in range(10):
    output_line = ",".join(lines[i+n] for n in range(0, 100, 10))
    print(output_line)