本文整理汇总了Python中bibtexparser.bwriter.BibTexWriter.entry_separator方法的典型用法代码示例。如果您正苦于以下问题:Python BibTexWriter.entry_separator方法的具体用法?Python BibTexWriter.entry_separator怎么用?Python BibTexWriter.entry_separator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bibtexparser.bwriter.BibTexWriter
的用法示例。
在下文中一共展示了BibTexWriter.entry_separator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_entry_separator
# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import entry_separator [as 别名]
def test_entry_separator(self):
bib_database = BibDatabase()
bib_database.entries = [{'ID': 'abc123',
'ENTRYTYPE': 'book',
'author': 'test'}]
writer = BibTexWriter()
writer.entry_separator = ''
result = bibtexparser.dumps(bib_database, writer)
expected = \
"""@book{abc123,
author = {test}
}
"""
self.assertEqual(result, expected)
示例2: write_bibtex_dict
# 需要导入模块: from bibtexparser.bwriter import BibTexWriter [as 别名]
# 或者: from bibtexparser.bwriter.BibTexWriter import entry_separator [as 别名]
def write_bibtex_dict (stream, entries):
"""bibtexparser.write converts the entire database to one big string and
writes it out in one go. I'm sure it will always all fit in RAM but some
things just will not stand.
"""
from bibtexparser.bwriter import BibTexWriter
writer = BibTexWriter ()
writer.indent = ' '
writer.entry_separator = ''
first = True
for rec in entries:
if first:
first = False
else:
stream.write ('\n')
stream.write (writer._entry_to_bibtex (rec))