Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8738

Re: Anyone want to critique this program?

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Anyone want to critique this program?
References <4be432d4-5185-4101-9699-de5524c3fa57@x3g2000yqj.googlegroups.com> <mailman.579.1309662170.1164.python-list@python.org> <5c3aba69-fddd-45ed-bf0c-8fa98df7aa73@r2g2000vbj.googlegroups.com>
Date 2011-07-04 07:37 +1000
Message-ID <87pqlrjbb6.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


John Salerno <johnjsal@gmail.com> writes:

> On Jul 2, 10:02 pm, Chris Angelico <ros...@gmail.com> wrote:
>
> > > game_information = '***Chutes and Ladders***\nUp to four (4) players
> > > may play.\n'\
> > >                   'There are 90 spaces on the board. '\
> > >                   'The player to reach space 90 first wins.'
> >
> > I'd do this with a triple-quoted string - it'll simply go across multiple lines:
> > game_information = """***Chutes and Ladders***
> > Up to four (4) players may play.
> > There are 90 spaces on the board.
> > The player to reach space 90 first wins."""
>
> Yeah, I considered that, but I just hate the way it looks when the
> line wraps around to the left margin.

    import textwrap

    game_information = textwrap.dedent("""\
        ***Chutes and Ladders***
        Up to four (4) players may play.
        There are 90 spaces on the board.
        The player to reach space 90 first wins.
        """)

-- 
 \      “Nothing is more sacred than the facts.” —Sam Harris, _The End |
  `\                                                   of Faith_, 2004 |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Anyone want to critique this program? John Salerno <johnjsal@gmail.com> - 2011-07-02 19:19 -0700
  Re: Anyone want to critique this program? Chris Angelico <rosuav@gmail.com> - 2011-07-03 13:02 +1000
    Re: Anyone want to critique this program? John Salerno <johnjsal@gmail.com> - 2011-07-02 20:41 -0700
      Re: Anyone want to critique this program? Chris Angelico <rosuav@gmail.com> - 2011-07-03 14:00 +1000
      Re: Anyone want to critique this program? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-07-03 18:06 +0000
        Re: Anyone want to critique this program? John Salerno <johnjsal@gmail.com> - 2011-07-03 20:25 -0700
          Re: Anyone want to critique this program? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-07-04 16:37 +0000
            Re: Anyone want to critique this program? Chris Angelico <rosuav@gmail.com> - 2011-07-05 03:21 +1000
              Re: Anyone want to critique this program? Ben Finney <ben+python@benfinney.id.au> - 2011-07-05 10:03 +1000
                Re: Anyone want to critique this program? Chris Angelico <rosuav@gmail.com> - 2011-07-05 10:11 +1000
      Re: Anyone want to critique this program? Ben Finney <ben+python@benfinney.id.au> - 2011-07-04 07:37 +1000

csiph-web