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


Groups > comp.lang.python > #33436

Re: editing conf file

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <thbach@students.uni-mainz.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; '16,': 0.03; 'subject:file': 0.07; 'separator.': 0.09; 'yet.': 0.13; 'comma': 0.16; 'yaml': 0.16; 'wrote:': 0.17; 'parse': 0.22; "haven't": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'supported': 0.26; 'there.': 0.28; '+0100,': 0.29; 'fri,': 0.30; 'lists': 0.31; "skip:' 20": 0.32; 'to:addr:python-list': 0.33; 'list': 0.35; 'nov': 0.35; 'something': 0.35; 'charset:us-ascii': 0.36; 'enough': 0.36; 'subject:: ': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'content- disposition:inline': 0.60; 'thomas': 0.62; 'configparser': 0.84; 'received:10.94': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-mainz.de; i=@uni-mainz.de; q=dns/txt; s=ironport; t=1353071520; x=1384607520; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=t5d/wUspYE15uZovEfRUzGvvmQoOCtj+pfQHsE2TSaM=; b=BnCqfTK5OiyO2xQ4W1HtFQ3JMFqM6LxNmSGew0WbyHFQ2kMk7hMA9lHe WH+cCgaZNcKz8xMhB9uKGURzIqk4R1mOtCQ5qs1e47wrq26dE3pP1zXbV S61TYmM297oYpYqBJZLrkxAAKdakX5kO5OQ0ahUeaiR5VNDa6hxMV8+qG 0=;
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result ApwEAGI6plAKXgZY/2dsb2JhbABEw26CHgEBBTpPCxgeEBQpIIgkvhaMM4FmgkZhA5V7AZBDgnCCGA
Date Fri, 16 Nov 2012 14:04:12 +0100
From Thomas Bach <thbach@students.uni-mainz.de>
To <python-list@python.org>
Subject Re: editing conf file
References <k85a7i$sjn$1@poprovec.arnes.si> <k85aoe$uot$1@poprovec.arnes.si> <996a6d6c-fdb2-40a0-bd5c-ada2ba35af78@i2g2000pbi.googlegroups.com> <k85cnl$84o$1@poprovec.arnes.si>
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Disposition inline
In-Reply-To <k85cnl$84o$1@poprovec.arnes.si>
User-Agent Mutt/1.5.21 (2010-09-15)
X-Originating-IP [94.219.177.91]
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3749.1353071521.27098.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353071521 news.xs4all.nl 6846 [2001:888:2000:d::a6]:45652
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33436

Show key headers only | View raw


On Fri, Nov 16, 2012 at 01:48:49PM +0100, chip9munk wrote:
> configparser has four functions: get, getboolean, getfloat and getint.
> 
> how do I get list from cfg file?!

AFAIK you have to parse the list yourself. Something like

my_list = [ s.strip() for s in cp.get('section', 'option').split(',') ]

if you use a comma as a separator.

Have a look at YAML if this is not enough for you, as I think lists
are supported there. Haven't had a look myself though, yet.

Regards,
	Thomas Bach.

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


Thread

editing conf file chip9munk <"chip9munk[SSSpAm"@gmail.com> - 2012-11-16 13:06 +0100
  Re: editing conf file chip9munk <"chip9munk[SSSpAm"@gmail.com> - 2012-11-16 13:15 +0100
    Re: editing conf file rusi <rustompmody@gmail.com> - 2012-11-16 04:35 -0800
      Re: editing conf file chip9munk <"chip9munk[SSSpAm"@gmail.com> - 2012-11-16 13:48 +0100
        Re: editing conf file Thomas Bach <thbach@students.uni-mainz.de> - 2012-11-16 14:04 +0100
          Re: editing conf file chip9munk <"chip9munk[SSSpAm"@gmail.com> - 2012-11-16 14:28 +0100
        Re: editing conf file Tim Chase <python.list@tim.thechases.com> - 2012-11-16 07:43 -0600
  Re: editing conf file Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-16 14:02 +0100
    Re: editing conf file chip9munk <"chip9munk[SSSpAm"@gmail.com> - 2012-11-16 14:27 +0100
      Re: editing conf file Roy Smith <roy@panix.com> - 2012-11-16 09:08 -0500
        Re: editing conf file rusi <rustompmody@gmail.com> - 2012-11-16 08:41 -0800

csiph-web