我有一长串要处理的文件,在 python 编程的 10 个步骤中,我试图创建一个makefile
来运行所有这些文件。由于某种原因,我不知道为什么,当我按照下面的代码运行它们时,第二步后输出为空。当我运行它们,一一调用时,代码可以工作,但是我在每一步中更改输出的名称,或者更改文件夹的输出,我不知道如何在makefiles
. 我也接受其他建议makefiles
(比如pypelines
......我对shell命令有点迷茫)
我的makefile
长相是这样的
zero::
for f in `ls data/wikiMaths/*.html`; do \
python src/maths/stripHtmlMaths.py $$f > $$f; \
done
one::
for f in `ls data/wikiMaths/*.html`; do \
python src/maths/Wiki2Text.py $$f > $$f; \
done
three::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/striphtml.py $$f > $$f; \
done
four::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/sipTrash.py $$f > $$f; \
done
five::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/tagFormula.py $$f > $$f; \
done
six::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/CountForm.py $$f > $$f; \
done
seven::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/stripWhiteSpace.py $$f > $$f; \
done
eight::
for f in `ls data/wikiMaths/*.txt`; do \
python src/maths/Text2Xml.py $$f > $$f.xml; \
done
nine::
for f in `ls data/wikiMaths/*.xml`; do \
python src/maths/Separate.py $$f > $$f; \
done
我想做的是:
zero::
for f in `ls data/wikiMaths/*.html`; do \
python src/maths/stripHtmlMaths.py $$f > data/newFolder/$$f; \
done
one::
for f in `ls data/newFolder/*.html`; do \
python src/maths/Wiki2Text.py $$f > data/newFolderTwo/$$f.txt; \
done
替换它:
python src/maths/stripHtmlMaths.py data/wikiMaths/file1.html > data/newFolder/file1.html
python src/maths/Wiki2Text.py data/newFolder/file1.html > data/newFolderTwo/file1.txt