<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: python code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 07 Oct 2008 13:27:13 GMT</pubDate>
    <description>DZone Snippets: python code</description>
    <item>
      <title>Python Comma Separated</title>
      <link>http://snippets.dzone.com/posts/show/620</link>
      <description>Separate a list of string in english-language list fashion, just like the Ruby snippet listed earlier.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def textList(listtext, sep1=', ', sep2=', and '):&lt;br /&gt;        return (len(listtext) &gt; 1 &lt;br /&gt;        and ("%s%s%s" % (sep1.join(listtext[:-1]), sep2, listtext[-1])) &lt;br /&gt;        or listtext[0])&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;['one'] -&gt; "one"&lt;br /&gt;['one', 'two', 'three'] -&gt; "one, two, and three"</description>
      <pubDate>Thu, 01 Sep 2005 17:39:14 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/620</guid>
      <author>jamwt (Jamie Turner)</author>
    </item>
  </channel>
</rss>
