0
我想知道什麼是在Python中使用通配符的最佳方式。我試圖將這段.ks代碼遷移到.py。如果文件夾中存在任何文件。我使用這些替代品喜歡思考: 水珠 os.path.exists =但這會變成真的還是假的 os.path.isfile len個? 這是我的代碼的一部分。如何使用通配符如果文件存在.py
#this is .ks
fail_flag=0
#Checking more than one file of any kind
files=$(ls /opt/flag/*)
for file in $file
do
if [ -f $file ] ; then
fail_flag=1
fi
done