6
rated 0 times
[
6]
[
0]
/ answers: 1 / hits: 67012
/ 3 Years ago, tue, august 17, 2021, 11:39:21
Through python script, I am trying to replace a string by a string in a file using sed
command. I do that through subprocess.call
as it in the script.
When I run the command in the shell script or command, it runs fine, but in python I get a result saying "No input file".
Any idea how to fix that error?
#!/usr/bin/python
import subprocess
subprocess.call(["sed -i -e 's/hello/helloworld/g'","www.txt"], shell=True)
Output
No input file
More From » scripts