aspose file tools*
The moose likes Jython/Python and the fly likes Is it possible to read properties file from python Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Is it possible to read properties file from python" Watch "Is it possible to read properties file from python" New topic
Author

Is it possible to read properties file from python

anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
Hai,
Agian iam having some doubt ,its on python .It uses C style file reading.
Will we be able to get configuration information from properties file using python.

Thanks and Regards
Anuja K
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42601
    
  65
Why shouldn't it be able to read the file? Python probably does not understand teh format of Java property files, so you will have to parse the lines to separate key and value, and also deal with comments, continuation lines and Unicode characters.


Ping & DNS - my free Android networking tools app
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Python has a module ConfigParser that can read java like properties file.
But it expects a header section in the file. For eg [db_defaults] is a section name.

anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
Hai Karthik ,
Can you give me some useful links or some more details on this .
Thanks & Regards
Anuja K
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
On windows, go to Start->Programs->Python 2.x->Module Docs.
This will start a http server on your machine. Click on 'open browser' and it will open the module docs in your browser. Look for ConfigParser in the documentation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to read properties file from python