Entry
Printing % literally
Jul 5th, 2000 09:58
Nathan Wallace, Hans Nowak, Snippet 1, Fredrik Lundh
"""
Packages: basic_datatypes.strings
"""
'''
>Trying to do something like:
>
>printer = "fasthp"
>
>print """
>%(printer)s: print command = lpr -r -s -h -b -P%p %s
>""" % vars()
>
>But the %p and %s entries cause errors. How do I
>get these interpreted literally? (They're not variables to
>Python, only to printcap)
try:
'''
printer = "fasthp"
print """
%(printer)s: print command = lpr -r -s -h -b -P%%p %%s
""" % vars()