with open("log.txt", "r") as file: lines = file.readlines() for line in lines[-10:]: print(line)
print_last_lines("log.txt", 10)
with open("log.txt", "r") as file: print(file.tail(10))
with open("log.txt", "r") as file: for line in file: if line.number() > len(file) - 10: print(line)
Discuss About this Question.
file.seek()
remove_file("data.txt")
os.remove("data.txt")
delete_file("data.txt")
file.delete("data.txt")
os.remove()
write_json("config.json", {"key": "value"})
with open("config.json", "w") as file: write_json(file, {"key": "value"})
json.write("config.json", {"key": "value"})
with open("config.json", "w") as file: json.dump({"key": "value"}, file)
open()
json.dump()
file.truncate()
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.