• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to read properties file from python

 
anuja Edathu
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Karthik ,
Can you give me some useful links or some more details on this .
Thanks & Regards
Anuja K
 
Karthik Guru
Ranch Hand
Posts: 1209
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic