Skip to content

Instantly share code, notes, and snippets.

@jvgomez
Created March 19, 2015 19:19
Show Gist options
  • Save jvgomez/8abba1c51ea9d0c4e71a to your computer and use it in GitHub Desktop.
Save jvgomez/8abba1c51ea9d0c4e71a to your computer and use it in GitHub Desktop.
test
# Creating test file
bibtex = """@ARTICLE{Cesar2013,
author = {Jean César},
title = {An amazing title},
year = {2013},
month = jan,
volume = {12},
pages = {12--23},
journal = {Nice Journal},
abstract = {This is an abstract. This line should be long enough to test
multilines...},
comments = {A comment},
keywords = {keyword1, keyword2}
}
"""
with open('data/bibtex.bib', 'w') as bibfile:
bibfile.write(bibtex)
# Import the package without installing it.
import sys
import os
btp_path = os.path.join('.', 'python-bibtexparser')
sys.path.append(btp_path)
import bibtexparser
# Load bibtex file and get its content as string.
with open('data/bibtex.bib') as bibtex_file:
bibtex_str = bibtex_file.read()
# Parse and show the string.
bib_database = bibtexparser.loads(bibtex_str)
print(bib_database.entries)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment