小编MTG*_*MTG的帖子

sh:1:语法错误:重定向意外的Python/Bash

我的python cmd脚本有问题.我不知道为什么它不起作用.我的代码可能有问题.我试图通过我的python脚本在cmdline中运行该程序.

我在bash中得到错误"sh:1:语法错误:重定向意外"

请帮助我只是生物学家:)

我使用spyder(anaconda)/ Ubuntu

#!/usr/bin/python

import sys
import os

input_ = sys.argv[1]
output_file = open(sys.argv[2],'a+')    
names = input_.rsplit('.')

for name in names:
    os.system("esearch -db pubmed -query %s  | efetch -format xml | xtract -pattern PubmedArticle  -element AbstractText >> %s" % (name, output_file))
    print("------------------------------------------")
Run Code Online (Sandbox Code Playgroud)

python bash shell bioinformatics

0
推荐指数
1
解决办法
2171
查看次数

如何连接dicts(值与同一键和新键的值)?

我有连接词典的问题.有这么多代码,所以我在示例中显示我的问题是什么.

d1 = {'the':3, 'fine':4, 'word':2}
+
d2 = {'the':2, 'fine':4, 'word':1, 'knight':1, 'orange':1}
+
d3 = {'the':5, 'fine':8, 'word':3, 'sequel':1, 'jimbo':1}
=
finald = {'the':10, 'fine':16, 'word':6, 'knight':1, 'orange':1, 'sequel':1, 'jimbo':1}
Run Code Online (Sandbox Code Playgroud)

它是wordcloud的字数.我不知道如何连接键的值,这对我来说很困惑.请帮忙.最好的祝福

python dictionary textedit word-cloud

0
推荐指数
1
解决办法
561
查看次数

标签 统计

python ×2

bash ×1

bioinformatics ×1

dictionary ×1

shell ×1

textedit ×1

word-cloud ×1