Created
November 16, 2025 13:43
-
-
Save alexmagaddino/3e140b7b6321d27bb34add10844c35ef to your computer and use it in GitHub Desktop.
Chess PNG from Italian to english annotation in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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