I am using python and sqlite3 to make a database of physics solutions. I have a lot of LaTeX code that I would like to store, but I’m running into a problem. A lot of LaTeX code has characters that python interprets instead of just accepting as literal text. For example, I’ve tried the following to store \frac{}{}:
foo = "\frac{}{}"
foo2 = """\frac{}{}"""
foo3 = '''\frac{}{}'''
print foo
rac{}{}
foo
Out[10]: '\x0crac{}{}'
I would really like it to just be stored verbatim, as the original ascii characters. Is there a way to do this?
Try to store them by prefixing the string with
r: