Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Read a java properties file in python

NotificationsYou must be signed in to change notification settings

hackorama/java-props-in-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux build statuscodecov.io

Read the key, element pairs from a java properties file

Follows thejava properties file format and tested against the Java 8 version ofjava.util.Properties

Documentation

dict getJavaProperties(file)

  • Args:
    • file: a valid file object (as returned byopen(filename))
  • Returns:
    • The property key and elements as a dict
  • Raises:
    • IOError: if file operation fails with I/O related reason
      • Corresponds to javaIOException inProperties.load()
    • UnicodeDecodeError: if the property file has malformed\uxxxx encoding,
      • Corresponds to javaIllegalArgumentException inProperties.load()
    • AttributeError: if invalid object was provided for file object
      • Corresponds to javaNullPointerException

Example

import jpropsprops = jprops.getJavaProperties(open("demo.properties"))print props['greeting']
$ cat demo.propertiesgreeting = hello world
$ python demo.pyhello world

About

Read a java properties file in python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp