所以,我正在编写一个 python 脚本,它将打开一个 tar 文件,如果其中有一个目录,我的脚本将打开该目录并检查文件......
E = raw_input("Enter the tar file name: ") // This will take input from the user
tf = tarfile.open(E) // this will open the tar file
现在检查“tf”是否有目录的最佳方法是什么?而不是去我的终端并在那里做 ls 我想在同一个 python 脚本中做一些事情来检查解压缩 tar 后是否有一个目录。