Skip to content

Instantly share code, notes, and snippets.

@ArthurDelannoyazerty
Last active March 27, 2024 10:26
Show Gist options
  • Save ArthurDelannoyazerty/16db62d5742b043b2ae3ea94031cc182 to your computer and use it in GitHub Desktop.
Save ArthurDelannoyazerty/16db62d5742b043b2ae3ea94031cc182 to your computer and use it in GitHub Desktop.
Remove the last character from a file
with open(filepath, 'rb+') as f:
f.seek(-1, 2)
f.truncate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment