我在python中执行shell命令时遇到问题。以下是导致错误的部分代码:
p = subprocess.Popen(["cat input.txt |apertium -d. kaz-morph|\
sed -e 's/\$\W*\^/$\n^/g'| cut -f2 -d'/'|cut -f1 -d '<'|\
awk '{print tolower($0)}'|sort -u>output.txt"], shell=True, stdout=f1)
仍在获取错误:未终止的“s”命令。你知道吗
希望你能帮我,因为我已经10天没法解决了
顺便说一句,对不起我的英语
'\n'
必须是'\\n'
,否则它将被解释为换行符,这将导致未终止的字符串"cat input.txt |apertium -d. kaz-morph|sed -e 's/\$\W*\^/$"
。你知道吗或者,将字符串标记为raw:
r"cat input.txt |apertium ...."
。你知道吗相关问题 更多 >
编程相关推荐