How do I make a command in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I make a command in Python?

I am wanting to know how'd I make a custom command in Python that can run when a user inputs something into the console

8th May 2022, 7:31 PM
Brennan Ferguson
4 Answers
+ 2
Do you mean a function? Functions will be explained in the sololearn course
8th May 2022, 8:03 PM
Lisa
Lisa - avatar
0
Oh, ok!
8th May 2022, 8:04 PM
Brennan Ferguson
0
You have to add a shebang to the start of the file with your pc's path to python. If you run a linux machine copy the script and lose the .py extension. Move the new file to your usr/bin/ directory and you will be able to type the file name and it will run the code like any other command.
8th May 2022, 8:10 PM
Slick
Slick - avatar
0
There's nothing to worry you will come to know while learning further🙂
10th May 2022, 3:47 PM
Tawkir Choudhury
Tawkir Choudhury - avatar