ConfigParser lower-cases options automatically?

Discussion in 'Python' started by Matthew Wilson, Nov 23, 2003.

  1. 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.
     
    Matthew Wilson, Nov 23, 2003
    #1
    1. Advertising

  2. Matthew Wilson

    Jarek Zgoda Guest

    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/
     
    Jarek Zgoda, Nov 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S.Ramaswamy
    Replies:
    3
    Views:
    534
    Miki Tebeka
    Jan 19, 2004
  2. Josh Close
    Replies:
    3
    Views:
    441
    Josh Close
    Aug 16, 2004
  3. Robin Munn
    Replies:
    1
    Views:
    357
    Istvan Albert
    Oct 12, 2004
  4. Replies:
    3
    Views:
    455
  5. Jonathan Fine
    Replies:
    0
    Views:
    452
    Jonathan Fine
    Nov 17, 2009
Loading...

Share This Page