Skip to content

Instantly share code, notes, and snippets.

@Fulgen301
Created April 15, 2017 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fulgen301/72143c6ee08f0994a65e57569d350fe4 to your computer and use it in GitHub Desktop.
Save Fulgen301/72143c6ee08f0994a65e57569d350fe4 to your computer and use it in GitHub Desktop.
import configparser
import os.path
class ClonkSection(configparser.SectionProxy):
def __getitem__(self, item):
try:
return super(ClonkSection, self)[item]
except KeyError:
return None
configparser.SectionProxy = ClonkSection
class ObjectConverter(object):
def __init__(self, path):
self.path = path
self.lines = []
with open(os.path.join(path, "Objects.txt"), "r") as fobj:
lines = fobj.read().replace("\r\n", "\n").split("\n\n")
for l in lines:
x = configparser.ConfigParser()
x.read_string(l)
self.lines.append(x["Object"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment