I am looking for a way, to invoke simple python one-liners directly from Windows cmd without the need to store a .py file somewhere.
Something like
python print('Test').
Is this possible?
asked Mar 6, 2020 at 10:54
Dschoni
3,9307 gold badges50 silver badges86 bronze badges
-
@Alex answer (below) pointed me to this resource: stackoverflow.com/questions/5048375/…Dschoni– Dschoni2020年03月06日 11:02:35 +00:00Commented Mar 6, 2020 at 11:02
2 Answers 2
Just use -c command line switch:
python -c "print('Test')"
Rahul Sharma
8,4072 gold badges39 silver badges58 bronze badges
answered Mar 6, 2020 at 10:56
Alex Sveshnikov
4,3391 gold badge13 silver badges27 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
you could just type python3 on your cmd and you'll get a sort of python debugger in which you can type and test your code.
so let's just type, print('Test') and it will execute
1 Comment
Dschoni
I know that, but that's not actually the question I'm having.
Explore related questions
See similar questions with these tags.
lang-py