Hello All
I am want to run a command "Merge -i file1.txt -i file2.txt -o out.txt" using python script. Here Merge is a exe file located in different path and file1, file2 are input to the exe file and out is output file. Can anyone suggest me out to run this command in python script.
Thank you
Raviteja_1 0 Newbie Poster
Recommended Answers
Jump to PostI do this so frequently that I created a bit of library code. It's so short that it should need no explanation.
import subprocess def execCmd(cmd=""): return subprocess.check_output(cmd, shell=True).decode().splitlines() if __name__ == "__main__": for line in execCmd(r"dir d:\temp"): print(line)
For your specific example just use
All 2 Replies
Reverend Jim 4,780 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
woooee 814 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.