https://github.com/sanderland/pysgf
Small and simple SGF parser for python
https://github.com/sanderland/pysgf
baduk go sgf weiqi
Last synced: 3 months ago
JSON representation
Small and simple SGF parser for python
- Host: GitHub
- URL: https://github.com/sanderland/pysgf
- Owner: sanderland
- License: mit
- Created: 2020-04-12T20:27:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-23T15:42:31.000Z (6 months ago)
- Last Synced: 2025-03-30T00:12:06.329Z (4 months ago)
- Topics: baduk, go, sgf, weiqi
- Language: Python
- Size: 90.8 KB
- Stars: 10
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PySGF
[](https://github.com/sanderland/pysgf/actions)
[](https://pypi.org/project/pysgf/)
[](https://github.com/ambv/black)PySGF is a lightweight but powerful parser for the Go SGF Format.
## Quickstart
```python
from pysgf import SGF
# parse either a string ..
root = SGF.parse(input_sgf)
# or pass a file name. It will try to detect the encoding specified in the SGF file
root = SGF.parse_file(input_file_name)
# all properties are stored as lists, but you can ask for the first
root.get_list_property('AB')
root.get_property('KM')
move = root.move # returns a Move object with options for SGF, GTP or 0- based coordinates
children = root.children # returns all child nodes
```## Documentation
For documentation, run `make html` in the `docs` directory.