【发布时间】:2019-01-24 06:24:43
【问题描述】:
我正在尝试使用通配符从 grep 获取输出
proc = subprocess.Popen(['grep', '002HQV', 'test.*'], stdout=subprocess.PIPE,
shell=True)
res = proc.stdout.readlines()
print(res)
但出现以下错误
2.4.3 (#1, Jun 11 2009, 14:09:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
[]
我的 grep 语法有问题吗?
以下作品
proc = subprocess.Popen(['ls', '*'], stdout = subprocess.PIPE, shell=True)
和
os.system("grep 02HQV test.*")
【问题讨论】:
标签: python