Skip to content

Instantly share code, notes, and snippets.

@alexmagaddino
Created November 16, 2025 13:43
Show Gist options
  • Select an option

  • Save alexmagaddino/3e140b7b6321d27bb34add10844c35ef to your computer and use it in GitHub Desktop.

Select an option

Save alexmagaddino/3e140b7b6321d27bb34add10844c35ef to your computer and use it in GitHub Desktop.
Chess PNG from Italian to english annotation in Python
#!/usr/bin/env python3
import sys
# Check if file argument is passed
if len(sys.argv) != 2:
print("Usage: python3 script.py <file>")
sys.exit(1)
filename = sys.argv[1]
# Read the file
with open(filename, "r", encoding="utf-8") as f:
text = f.read()
# Replace Italian PNG annotation letters to English PNG letters
text = text.replace("R", "K")
text = text.replace("D", "Q")
text = text.replace("T", "R")
text = text.replace("A", "B")
text = text.replace("C", "N")
# Write the modified file
with open(filename, "w", encoding="utf-8") as f:
f.write(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment