MRAB <goo...@mrabarnett.plus.com> wrote:

> You might also want to try a triple-quoted string, which makes it
> clearer:
> 
> codeblock = """def codefun(code):
>      if code == 0:
>          return "B"
>      else:
>          return ""
> """
> 

Possibly the clearest way to do something like that is to use a single 
backslash escape and then all the vertical alignment is exactly as you see 
it:

codeblock = """\
def codefun(code):
     if code == 0:
         return "B"
     else:
         return ""
"""
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to