import osimport platform# 编写一个类实现文件相对路径读取功能class Properties:def __init__(self, filename, isroot):self.filename = filenameself.isroot = isrootdef getfilepath(self):if self.isroot:if platform.system() == "Windows":return os.path.abspath("..") + "\\" + self.filenameelse:return os.path.abspath("..") + "/" + self.filenameelse:if platform.system() == "Windows":return os.path.abspath(".") + "\\" + self.filenameelse:return os.path.abspath(".") + "/" + self.filenamedef getProperties(self):properties = {}filepath = self.getfilepath()lines = open(filepath, "r").readlines()for line in lines:if line.find('=') > 0:strs = line.replace('\n', '').split('=')properties[strs[0]] = strs[1]return properties
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。