This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 41141
    
  45
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is it possible to read properties file from python
 
Similar Threads
which is best platform form for Cloud devlopement ?
WA #1.....word association
Automating Command line installation
JDBC-ODBC bridge any other options
how to call a servlet from Python?????