Skip to content

Instantly share code, notes, and snippets.

@Daemonslayer2048
Last active June 11, 2019 13:29
Show Gist options
  • Save Daemonslayer2048/15eda9149fc8d4c13768f24ecd9bd481 to your computer and use it in GitHub Desktop.
Save Daemonslayer2048/15eda9149fc8d4c13768f24ecd9bd481 to your computer and use it in GitHub Desktop.
Reading output from subprocess.Popen #Python
def clear_schedule():
output = subprocess.Popen(['atq'], stdout=subprocess.PIPE, shell=True)
queue = output.communicate()[0].decode('utf-8')
for job in queue.splitlines():
qid = job.split('\t', 1)[0]
print (qid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment