Answers for "python console commands"

23

execute command in python script

import os

os.system("ma Commande")

#Exemple:

os.system("cd Documents")
Posted by: Guest on June-10-2020
4

python bash command

import os
os.system('clear')
Posted by: Guest on August-28-2020
2

how to do a console command with python

import subprocess

subprocess.run("Your command here")
Posted by: Guest on August-01-2021
3

python run a system command

import os
cmd = "git --version"
returned_value = os.system(cmd)  # returns the exit code in unix
Posted by: Guest on April-01-2020
0

run python with options

import argparse
import sys

parser = argparse.ArgumentParser(description="Does some awesome things.")
parser.add_argument('message', type=str, help="pass a message into the script")

if __name__ == '__main__':
    args = parser.parse_args(sys.argv[1:])
    print args.message
Posted by: Guest on April-30-2020
0

python console

print(ord('Z'))
Posted by: Guest on September-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language