xxxxxxxxxx
python -c "for i in range(3): import numpy as np; print(np.ones(4))"
# With this syntax, remember to write str like: python -c "print('hi Brazil')"
xxxxxxxxxx
CMD /K - execute a command then remain
import os
os.system('cmd /k "Your Command Prompt Command"')
xxxxxxxxxx
import os
os.system("ma Commande")
#Exemple:
os.system("cd Documents")
xxxxxxxxxx
// To run pytho script from CMD
// type python and the name of the file. Assuming hello.py
python hello.py
xxxxxxxxxx
# press [windows] + [R] (on windows only)
# use the command : cd/the_way_of_your_program
# and now use this command :
py the_name_of_your_program.py
# don't forget to write the extension (py for python)
# at the end of your program name
xxxxxxxxxx
from os import system
system("echo off")
system("echo print(\"hi\") > file.py")
system("py file.py")