python -c argument in support of the implementation of one-line command / script.
example:
> python -c "import os;print('hello'),print('world')" > python -c "import os;print('hello');print('world')"
NOTE: use a command to wrap double quotes, ** To Import; end, command [] enclosed, a plurality of multi-line command [] **
> python -c "import os,time;[print(i) for i in os.listdir()];[print(time.time())]" > python -c "import os,time;[print(i) for i in os.listdir()],[print(time.time())]"
Complex command must be used ** [] ** quotes, otherwise it will error.
On the Format can also try a bit:
> python -c "print('hello');print('world')" > python -c "print('hello'),print('world')" > python -c "[print('hello'),print('world')]" > python -c "[print('hello')],[print('world')]"
These articles of the output is the same.
the above.
----------------
Disclaimer: This article is CSDN blogger original article "phoenix339", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/phoenix339/article/details/90405610