Special character '/' in ConfigParser Python

295 views Asked by At

I've encountered the following problem using the ConfigParser in Python 2.6. I have the string 'A End NE Frame/shelf' as a header of a column in a .csv file and I'm receiving the following error when I try to run the code:

ValueError: field named A_End_NE_Frame/shelf not found.

Here is the config.ini file:

[Aend]
Name: A_End_NE_Name
Shelf: A_End_NE_Frame/shelf
[Zend]
Name: Z_End_NE_Name
Shelf: Z_End_NE_Frame/shelf

And here is an example from the input data that I need to process:

A End NE Name   A End NE Frame/shelf    Z End NE Name        Z End NE Frame 
    DBE01                1               NGRPG01_OSN35_2             1

I'm 99,99% sure that the problem is the '/' character because if i replace it the code works perfectly. Is there a way to read the '/'?

1

There are 1 answers

0
Shijo On

You have underscore in Config data and there is no underscore in csv header name