Jul-01-2023, 10:35 AM
Hello everybody,
I got a backup of a bunch of chess games (from chess.com) I played with a friend of mine and wanted to save them as individual files. Now I only have a complete file with all games but I noticed, that every individual game begins with the string "[Event "Let's Play!"]".
Now I want to create a python script which checks for the string and saves everything to a file until the string occurs again, but I'm not sure how to do so. I thought of using a for-loop which looks for the string, saves everything to a file (with increasing counter) until the string comes again and the loop repeats.
My first problem is, how take only the "difference" between the string?
I got a backup of a bunch of chess games (from chess.com) I played with a friend of mine and wanted to save them as individual files. Now I only have a complete file with all games but I noticed, that every individual game begins with the string "[Event "Let's Play!"]".
Now I want to create a python script which checks for the string and saves everything to a file until the string occurs again, but I'm not sure how to do so. I thought of using a for-loop which looks for the string, saves everything to a file (with increasing counter) until the string comes again and the loop repeats.
My first problem is, how take only the "difference" between the string?