私は pythons に関するいくつかの誤解を学び、解決してきましたsys.argv
。bash のコマンドラインからさまざまな文字を渡していたとき、次のことに気付きました。
script.py
import sys
def test(x):
return x
print test(sys.argv)
>>>python script.py [first, second, third]
印刷します:
['script.py', '[first,', 'second,', 'third]']
と
>>>python script.py {first, second, third}
['script.py', '{first,','second,','third}']
しかし:
>>>python script.py (first,second,third)
bash: syntax error near unexpected token `('
これはpythonまたはbashですか、おそらく両方ですか?理由はありますか?