mattharrison / Tiny-Python-3.6-Notebook

This repository contains the text for the Tiny Python 3.6 Notebook.
1.35k stars 220 forks source link

Context Managers example will not return expected text #2

Closed FHeilmann closed 7 years ago

FHeilmann commented 7 years ago
>>> def start(env):
...     return '\begin{}'.format(env)

will cause start('center') to return egincenter. You need to escape the backslash and the curly braces like so:

>>> def start(env):
...     return '\\begin{{{}}}'.format(env)

same for end(env):

>>> def end(env):
...      return '\\end{{{}}}'.format(env)

edit:

the same applies for Function Based Context Managers and Class Based Context Managers

mattharrison commented 7 years ago

Fixed by your PR. THanks