本文整理汇总了Python中File.File.exists方法的典型用法代码示例。如果您正苦于以下问题:Python File.exists方法的具体用法?Python File.exists怎么用?Python File.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File.File
的用法示例。
在下文中一共展示了File.exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from File import File [as 别名]
# 或者: from File.File import exists [as 别名]
print "Please choose from the following menu:"
print "1) Move File "
print "2) Calculator"
print " "
choice = int(raw_input("Choose your option:").strip())
if choice == 1:
opsys = platform.system()
sourcePath = r"C:\Users\achock\PythonDev"
destPath = r"C:\Users\achock\PythonDev"
print "Welcome"
print "Current working dir : %s" % os.getcwd()
print "Please name your file"
fname = raw_input("Enter name of file\n")
file = File(sourcePath, destPath, fname)
fnew = os.path.isfile(fname) # checks to see if the file exist on curdirectory
file.exists(fnew) # gives message if exists
destPath = raw_input(
"Enter the directory in which you would like to copy file. \n For example C:\Users\achock\PythonDev\n"
)
ndir = os.path.isdir(destPath)
file.verDir(ndir)
file.moveFile(fname, destPath, opsys)
elif choice == 2:
print "Your options are:"
print " "
print "1) Addition"
print "2) Subtraction"
print "3) Multiplication"
print "4) Division"
print "5) Quit calculator"
print " "