让html变量是一个包含整个网页源代码的字符串,例如
html = "<!doctype html>\n<html><head><title>My title</title></head>LOTS OF CHARS HERE</html>"
如果可能的话,我想以print人类可读的格式制作这个网页lynx。我尝试了各种各样的事情
print(subprocess.run(['echo', html, '|', 'lynx', '-stdin', '-dump'], capture_output=True, text=True).stdout)
或者
p1 = subprocess.Popen(["echo", html], stdout=subprocess.PIPE)
print(subprocess.run(['lynx', '-stdin', '-dump'], stdin=p1.stdout, capture_output=True, text=True).stdout)
但它失败并出现以下错误
OSError:[Errno 7] 参数列表太长:'echo'
知道如何使它工作吗?