On Feb 15, 10:27 am, Steven D'Aprano <st...@pearwood.info> wrote:
> Philipp Pagel wrote:
> > zaheer.ag...@gmail.com wrote:
> >> Hi
>
> >> How do i read  a file in Python and search a particular pattern
> >> like I have a file char.txt  which has
>
> >> Mango=sweet
> >> Sky=blue
>
> >> I want to get the strings sweet and blue,How to do this..?
>
> > If your entire file consists of such key=value pairs you may want to
> > properly parse them:
>
> The proper way to parse them would be with the ConfigParser module.
>
> The only negative with ConfigParser is that it requires a section label. In
> my experience it is quite common for INI files with only a single section
> to leave out the label.
>
> --
> Steven

Thanks to all of you,I used to ConfigParser worked fine.

-Zaheer
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to