Long programs using python -c switch

后端 未结 4 1304
执笔经年
执笔经年 2021-01-06 09:46

I would like to use python for things I\'ve been doing using bash. Is it possible to use the -c switch for long programs, e.g. a for loop with two statements? This would let

4条回答
  •  心在旅途
    2021-01-06 09:54

    When used inside a script, I think it would be better to have python read the script from standard input, like so:

    #!/bin/bash
    
    python - arg1 arg2 <

    This uses bash's HEREDOC syntax.

提交回复
热议问题