You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a pgn with comments and subvariations, for example starting like this:
e4 e5 { Open Game } 2. Nf3 { The main move. } ( 2. d4 { Center Game } ....
I managed to print out all the comments for the mainline with the following code:
for node in game.mainline():
print(node.comment)
I tried several things but I simply don't manage to get a specific comment of the mainline or even more important one of a specific subline.
I wonder how I can print out the comment of the second move "The main move" only?
And what would I need to write to get the comment of the subvariatn with 2.d4: "Center Game" ?
I tried it for several hours, I found something with "node.variations" or "GameNode" in the internet which might be the right thing to use. Unfortunately I failed to implement any of this.
Thank you for any suggestion or idea.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am a total beginner, thus sorry for asking:
Let's say I have a pgn with comments and subvariations, for example starting like this:
I managed to print out all the comments for the mainline with the following code:
for node in game.mainline():
print(node.comment)
I tried several things but I simply don't manage to get a specific comment of the mainline or even more important one of a specific subline.
I wonder how I can print out the comment of the second move "The main move" only?
And what would I need to write to get the comment of the subvariatn with 2.d4: "Center Game" ?
I tried it for several hours, I found something with "node.variations" or "GameNode" in the internet which might be the right thing to use. Unfortunately I failed to implement any of this.
Thank you for any suggestion or idea.
Beta Was this translation helpful? Give feedback.
All reactions