文本划分
您好,谢谢您的任何帮助,我需要帮助
我有此代码 他读了5-10行,但我需要重新进行它,
f=open("input.txt", encoding='utf-8')
lines=f.readlines()
for x in range(5,10):
print(lines[x])
我正在寻找此输出的
第一个输入第二是输出图像
输入
1-100 lines
IM搜索此数字搜索列表中的search in List
xx = lambda n:n and list(range(n,100,9))
print(xx(num))
Output utpute行只有文本
[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]
这只是一个示例,我的文本为33,000行
hello and thank you for any help I need help
I have this code
he reads the 5-10 lines but I need to remake it
f=open("input.txt", encoding='utf-8')
lines=f.readlines()
for x in range(5,10):
print(lines[x])
I am looking for this output
first input second is output image
input
1-100 lines
im search this number search in list
xx = lambda n:n and list(range(n,100,9))
print(xx(num))
output lines is text
[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]
just make a square
from 1 to 10 down from 11 to 20 down etc ...
there is text on the lines so that, for example, all 10 texts are combined into one
[1, 11, 21, 31, 41, 51, 61, 71, 81, 91]
this is just an example I have a long text of 33 thousand lines
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将10添加到列表索引,以便以后获取第10行的内容。
Add 10 to the list index to get the contents of the line 10 rows later.