python - Python包含shell路径文件名
问题描述
这是我在 shell 中的代码,我包含了 python 命令:
for file in `ls $FOLDER`
do
echo "$file"
var=`python -c "from Bio import SeqIO, SeqUtils; import os; rec = SeqIO.read("**$FOLDER/$file**", 'fasta'); SeqUtils.xGC_skew(rec.seq, 220000)" `
done
而且我不知道如何让python识别我的文件名
解决方案
您需要在 python 代码中转义双引号:
for file in `ls $FOLDER`
do
echo "$file"
var=`python -c "from Bio import SeqIO, SeqUtils; import os; rec = SeqIO.read(\"$FOLDER/$file\", 'fasta'); SeqUtils.xGC_skew(rec.seq, 220000)" `
done
推荐阅读
- google-apps-script - 根据 Google 工作表上的复选框隐藏/取消隐藏行
- loops - 使用 Bash 脚本在 Linux 中循环多个输入系列
- vue.js - 将道具传递给捆绑的 vuejs 项目
- apache-spark - 在 SparkRunner 上使用 Apache Beam Pipeline 流式传输到 BigQuery
- python - “Discord.py”有没有办法在有人更改昵称时立即重置某人的昵称?
- python - QTreeWidget:如何动态更改 sizeHint?
- entity-framework-5 - 不同项目方法上的实体框架核心迁移问题
- reactjs - Redux 中的多次加载
- android - 在 Android Studio App 中设置 Google 样式的底部对话框?
- amazon-web-services - 如何从 Java 中的 AWS 证书管理器访问证书详细信息和私钥以构建 SSLContext?