I am wanting to execute python command by using python -c but it contain in string library so i need import it. While reading man i find this:

when called with -c  command,  it  executes  the
   Python  statement(s) given as command.  Here command may contain multi‐
   ple statements separated by newlines.  Leading whitespace  is  signifi‐
   cant  in  Python statements!  In non-interactive mode, the entire input
   is parsed before it is executed.

For example I've tried python3 -c "import string \n print(string.ascii_letters)" but it didn't work. So what is it new line?


1 Answer 1


This is not really a re related question. But you can do something like this:

python3 -c 'import string;print(string.ascii_letters)'
  • Thank you so much
    – Inc.ace
    Mar 7, 2021 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.