我打算打開多個文件(一個接一個,在bash終端中使用for循環),並使用PLINK(一個程序)和稍後的python函數修改它。以下是代碼:python函數與for循環在bash終端
for i in {1..10}; do
plink --cow --noweb --lfile $i --extract extract1.snp --recode --out 1$i
python -c 'import file_convert;file_convert.convert_tree_mix("1$i.map","tmp$i")'
done
但是,正如預期,蟒蛇無法讀取,無法打開「11.map」,它並沒有取代「$ I」與1.如何修改代碼,以便蟒蛇功能,與組合for循環,打開不同的文件基礎上的價值每一次「我」
嘗試'蟒蛇-c 「進口file_convert; file_convert.convert_tree_mix(\」 $ 1 i.map \ 「\ 」TMP $ I \「)」' –
非常感謝你,它的工作:) –