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


Groups > comp.lang.python > #17325

Re: How to generate "a, b, c, and d"?

References <9393353.282.1323967703697.JavaMail.geo-discussion-forums@vbyc2> <4EEA2DF2.9080107@mrabarnett.plus.com> <jce51p$5t4$1@dough.gmane.org>
Date 2011-12-16 13:42 +1100
Subject Re: How to generate "a, b, c, and d"?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3710.1324003340.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Dec 16, 2011 at 11:57 AM, Terry Reedy <tjreedy@udel.edu> wrote:
>  items[-1] = "and " + items[-1]
>  return ", ".join(items)

This works only if you're sure there are at least two items, and if
you don't mind two items coming out as "a, and b".

ChrisA

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


Thread

How to generate "a, b, c, and d"? Roy Smith <roy@panix.com> - 2011-12-15 08:48 -0800
  Re: How to generate "a, b, c, and d"? MRAB <python@mrabarnett.plus.com> - 2011-12-15 17:27 +0000
  Re: How to generate "a, b, c, and d"? Tim Chase <python.list@tim.thechases.com> - 2011-12-15 12:01 -0600
  Re: How to generate "a, b, c, and d"? Ethan Furman <ethan@stoneleaf.us> - 2011-12-15 10:19 -0800
  Re: How to generate "a, b, c, and d"? Tim Chase <python.list@tim.thechases.com> - 2011-12-15 12:51 -0600
    Re: How to generate "a, b, c, and d"? Roy Smith <roy@panix.com> - 2011-12-15 11:01 -0800
    Re: How to generate "a, b, c, and d"? Roy Smith <roy@panix.com> - 2011-12-15 11:01 -0800
  Re: How to generate "a, b, c, and d"? MRAB <python@mrabarnett.plus.com> - 2011-12-15 19:27 +0000
  Re: How to generate "a, b, c, and d"? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-15 14:22 -0700
  Re: How to generate "a, b, c, and d"? Terry Reedy <tjreedy@udel.edu> - 2011-12-15 19:57 -0500
  Re: How to generate "a, b, c, and d"? Chris Angelico <rosuav@gmail.com> - 2011-12-16 13:42 +1100
  Re: How to generate "a, b, c, and d"? Terry Reedy <tjreedy@udel.edu> - 2011-12-16 00:26 -0500

csiph-web