Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > ConfigParser lower-cases options automatically?

Reply
Thread Tools

ConfigParser lower-cases options automatically?

 
 
Matthew Wilson
Guest
Posts: n/a
 
      11-23-2003
I'm using ConfigParser to store and retreive some data across multiple
runs of my program and it looks like it automatically lower-cases my
options:

---this is the program:

import ConfigParser
cp = ConfigParser.ConfigParser()
cp.add_section('info')
cp.set('info', 'Previous-IP', '0.0.0.0')
out = open('out.txt', 'w')
cp.write(out)
out.close()
out = open('out.txt')
print out.read()

---here is the data:

[info]
previous-ip = 0.0.0.0

---end


I wonder if this is something intentionally built-in to ConfigParser in
order to remove case-sensitivity issues that are variable across
platforms. Does anyone else have any comments or ideas? I don't need
case-sensitivity in my script, but I am puzzled by this behavior.



 
Reply With Quote
 
 
 
 
Jarek Zgoda
Guest
Posts: n/a
 
      11-23-2003
Matthew Wilson <> pisze:

> I wonder if this is something intentionally built-in to ConfigParser in
> order to remove case-sensitivity issues that are variable across
> platforms. Does anyone else have any comments or ideas? I don't need
> case-sensitivity in my script, but I am puzzled by this behavior.


Yes, I think it was intentional. Check optionxform() in Python
documentation to get an idea how to make ConfigParser case sensitive.

--
Jarek Zgoda
Unregistered Linux User #-1
http://www.zgoda.biz/ JID: http://zgoda.jogger.pl/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FYI: ConfigParser, ordered options, PEP 372 and OrderedDict + bigthank you Jonathan Fine Python 0 11-17-2009 04:59 PM
ConfigParser: Can I read(ConfigParser.get()) a configuration file anduse it to call a funciton? jamitwidme@gmail.com Python 3 06-26-2008 08:01 PM
Options, ConfigParser, modules, and SQLObject connections Robin Munn Python 1 10-12-2004 07:17 PM
ConfigParser options spanning more than one line Josh Close Python 3 08-16-2004 06:57 PM
ConfigParser - setting the order of options in a section S.Ramaswamy Python 3 01-19-2004 10:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57