python接受用户从键盘输入的一个文件名,然后判断该文件是否存在于当前目录

如题所述

第1个回答  2021-05-31
import os
#file_name =input()
file_name = '/var/mobile/Containers/Data/Application/EA5CB557-C49B-44CF-B4D5-013A1F9C2462/Documents/KeepData/files/test3.txt'
print(os.path.exists(file_name))