<p>如果存在一个简单的.txt-04目录,请参阅“我在使用一个简单的.txt-04目录下的程序。我有两个问题。在</p>
<p>A)我想在正则表达式中使用变量datestr。不知道该怎么做。在</p>
<p>B)其次,我的打印(文件名)在airflow UI中显示在哪里?我查了查看日志,但什么也没显示出来。在</p>
<pre><code>def checksFile():
d = datetime.today()-timedelta(days=1)
datestr = '{:%Y-%m-%d}'.format(d)
for filename in os.listdir('/mnt/volume/home/aabraham/'):
match = re.search('(test)-(2018-06-04)-(\d+)(\.txt)', filename)
print(filename)
if not match:
raise AirflowException("File not Found")
</code></pre>