Untitled
unknown
python
2 years ago
448 B
37
Indexable
def remove_username_from_file(username, file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
with open(file_path, 'w') as file:
indicelinea = 0
for line in lines:
for user in username:
if line.strip() == user.strip():
del lines[indicelinea]
file.writelines(lines)
indicelinea +=1
Editor is loading...