本文整理汇总了Python中shell.Shell.delete_file方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.delete_file方法的具体用法?Python Shell.delete_file怎么用?Python Shell.delete_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shell.Shell
的用法示例。
在下文中一共展示了Shell.delete_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: while
# 需要导入模块: from shell import Shell [as 别名]
# 或者: from shell.Shell import delete_file [as 别名]
while(True):
command=raw_input("> ").split(" ")
operation=command[0]
if (operation == "help"):
print " - backup <file> (<replication degree>)"
print " - restore <file>"
print " - delete <file>"
print " - delete2 <file> : enhancement of delete"
print " - exit"
elif (operation=="backup"):
file_name=command[1]
replication_degree=2
if (len(command)==3):
replication_degree=int(command[2])
if(os.path.exists(file_name)):
shell.backup_file(file_name, replication_degree)
else:
print "ERROR - Invalid file path"
elif (operation=="restore"):
file_name=command[1]
shell.restore_file(file_name)
elif (operation=="delete"):
file_name=command[1]
shell.delete_file(file_name)
elif (operation=="delete2"):
file_name=command[1]
shell.delete2_file(file_name)
elif(operation=="exit"):
break