Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- arr = os.listdir()
- print(arr)
- n = 3 #the number of line to be read and deleted
- for i in range(len(arr)):
- print(i)
- print(arr[i])
- file = open(arr[i], 'r')
- file_name = str(arr[i]) + '0'
- print(file_name)
- file_new= open(file_name, 'a')
- Lines = file.readlines()
- count = 0
- for line in Lines:
- count = count+ 1
- if (count>3):
- file_new.write(line)
- file_new.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement