On 12/19/22, Jach Feng <jf...@ms4.hinet.net> wrote:
>
> That's really good for Linux user! How about Windows?

In CMD, typing the "^" escape character at the end of a line ignores
the newline and prompts for "more" input. If you press enter again,
you'll get another "more" prompt in which you can write the rest of
the command line. Command-line arguments are separated by spaces, so
you have to start the next line with a space if you want it to be a
new argument. Also, "^" is a literal character when it's in a
double-quoted string, which requires careful use of quotes. For
example:

    C:\>py -c "import sys; print(sys.orig_argv[3:])" spam^
    More?
    More?  eggs^
    More?
    More? " and spam"
    ['spam\n', 'eggs\n and spam']

The above is easier in PowerShell, which supports entering multiline
strings without having to escape the newline. The second-level prompt
is ">> ". For example:

    > py -c "import sys; print(sys.orig_argv[3:])" spam"
    >> " eggs"
    >>  and spam"
    ['spam\n', 'eggs\n and spam']
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to