Python
- Remove all lines but last 10 rows and a column.
lines = []
with open('log.txt', 'r') as f:
lines = f.readlines()
with open('log.txt', 'w') as f:
f.writelines(lines[:1] + lines[-9:])
log.txt
- Input
COLUMN
1
2
3
4
5
6
7
8
9
10
11
12
- Output
COLUMN
3
4
5
6
7
8
9
10
11
12
댓글 없음:
댓글 쓰기