1

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
1

2 Answers 2

5

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
Sign up to request clarification or add additional context in comments.

Comments

-1

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

answered Mar 6, 2020 at 10:58

1 Comment

I know that, but that's not actually the question I'm having.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.