Execute command on linux terminal using subprocess in python
问题 I want to execute following command on linux terminal using python script hg log -r "((last(tag())):(first(last(tag(),2))))" work This command give changesets between last two tags who have affected files in "work" directory I tried: import subprocess releaseNotesFile = 'diff.txt' with open(releaseNotesFile, 'w') as f: f.write(subprocess.call(['hg', 'log', '-r', '"((last(tag())):(first(last(tag(),2))))"', 'work'])) error: abort: unknown revision '((last(tag())):(first(last(tag(),2))))'!