0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【python】import sys sys.argv の使い方

Posted at

#環境
linux
python
#pythonコード

コードは例として以下のようにする。

practice.py
import sys

a = sys.argv

print(a)

#コマンドプロンプト
以下のコマンドを実行

$ python3 practice_home.py linux windows abc
['practice_home.py', 'linux', 'windows', 'abc']

すると、以上のように__['practice_home.py', 'linux', 'windows', 'abc']__が出力される。

つまり、sys.argvは $ pyton3__の後の文字__が入る。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?