473,698 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why does Configparser change names to lowercase ?

hello,

Why does Configparser change names to lowercase ?

As Python is case sensitive (which btw I don't like at all ;-)
but now when really need the casesensitivity ,
because it handles about names which should be recognized by human,
it changes everything to lowercase ????

thanks,
Stef Mientki
Sep 14 '07 #1
2 12114
stef mientki wrote:
hello,

Why does Configparser change names to lowercase ?
Because it is an annoying module and should be tossed for something
better? Try this instead (and never look back):

http://www.voidspace.org.uk/python/configobj.html

As Python is case sensitive (which btw I don't like at all ;-)
but now when really need the casesensitivity ,
because it handles about names which should be recognized by human,
it changes everything to lowercase ????
So you are saying the case sensitivity is a good thing--or maybe you are
still running Mac System 7 on your CSIIsi marveling at the wonders of HFS?

James
Sep 14 '07 #2
stef mientki <st**********@g mail.comwrites:
hello,

Why does Configparser change names to lowercase ?

As Python is case sensitive (which btw I don't like at all ;-)
but now when really need the casesensitivity ,
because it handles about names which should be recognized by human,
it changes everything to lowercase ????
I don't know why, but I know how to change it and I found the solution here:
http://docs.python.org/lib/RawConfigParser-objects.html

You need to change the implementation of method `optionxform`, e.g.:

# config
[section1]
option1=item1
Option2=item2
option2=item3

# cfg.py
from ConfigParser import ConfigParser

config = ConfigParser()
config.optionxf orm = str
config.read('co nfig')
print config.get('sec tion1', 'option1')
print config.get('sec tion1', 'Option2')
print config.options( 'section1')

HTH,
Rob
Sep 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6780
by: Matthew Barnes | last post by:
I'm considering submitting a patch for Python 2.4 to allow environment variable expansion in ConfigParser files. The use cases for this should be obvious. I'd like to be able to specify something like the following in a configuration file: data_file=${HOME}/mydata.dat ....(where HOME=/home/matt) and have ConfigParser automatically expand it to:
3
683
by: Sergey | last post by:
Is there an alternative to standard module ConfigParser, which can use delimitier symbol other than ":" and "=", preferaby just space? I need to parse such configs: 2:5020/758 xxxx 2:5020/794 yyyy ConfigParser is not able to work with option names which contain symbol ':' It is not difficult to modify ConfigParser to resolve it, but may be another
3
11697
by: mwt | last post by:
I want to set default values for a ConfigParser. So far, its job is very small, so there is only one section heading, . Reading the docs, I see that in order to set default values in a ConfigParser, you initialize it with a dictionary or defaults. However, I'm not quite sure of the syntax to add the section headings in to the dictionary of defaults. For now, I'm doing it like this: default_values = {'username' : 'put username here',...
3
4351
by: tony.ha | last post by:
Hello I use ConfigParser as show below to read a config.txt file; from ConfigParser import ConfigParser config = ConfigParser() config.read('config.txt') items = config.items('FV') for item in items: module_name = item print module_name
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.