本文整理汇总了Python中FileSystem.FileSystem.remove方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.remove方法的具体用法?Python FileSystem.remove怎么用?Python FileSystem.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UserSettings
# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import remove [as 别名]
class UserSettings():
def __init__(self, fileName=None, fileSystem=None):
if fileSystem is not None:
self.fileSystem = FileSystem()
self._settingsVariables = dict()
if fileName is not None:
self.setFile(fileName)
def set(self, variable, value):
self._settingsVariables[variable] = value
settingsNewContent = json.dumps(self._settingsVariables)
return self.fileSystem.replaceFile(self.fileName, settingsNewContent)
def get(self, variableName):
return self._settingsVariables[variableName]
def deleteAll(self):
self.fileSystem.remove(self.fileName)
def setFile(self, fileName):
self.fileName = fileName
userSettingsExist = self.fileSystem.isfile(fileName)
if userSettingsExist != True:
settingsContent = "{\n}"
created = self.fileSystem.createFile(fileName, settingsContent)
else:
settingsContent = self.fileSystem.getFileContent(self.fileName)
self._settingsVariables = json.loads(settingsContent)