Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gets the EBNF of the Golang spec at
from bs4 import BeautifulSoup
import requests
r = requests.get('')
soup = BeautifulSoup(r.text)
bnf = soup.find_all('pre', class_='ebnf')
bnftxt = [x.get_text() for x in bnf]
bnftxt = ''.join(bnftxt)
with open('go-out.txt', 'w') as f:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment