は、私は私のFTPサーバ(更新今日)に最新のファイル/ディレクトリを取得する必要があり、私はこの解決策を発見しました:Pythonの取得最近のファイルFTP
def callback(line):
try:
#only use this code if you'll be dealing with that FTP server alone
#look into dateutil module which parses dates with more flexibility
when = datetime.strptime(re.search('[A-z]{3}\s+\d{1,2}\s\d{1,2}:\d{2}', line).group(0), "%b %d %H:%M")
today = datetime.today()
if when.day == today.day and when.month == today.month:
pass
print "Updated file"
#####THE CODE HERE#######
except:
print "failed to parse"
return
ftp.retrlines('LIST', callback)
をしかし:このコードでは、私が唯一の倍数を取得"解析に失敗しました"、また "更新されたファイル" - 印刷物を倍数にします。しかし、今日更新されたファイル/ディレクトリのファイル/ディレクトリ名が必要です。 "##### CODE HERE #######"に貼り付けるコードは何ですか?ディレクトリ名を取得するには?