質問編集履歴

5

追加

2020/04/16 14:54

投稿

python_wakaran
python_wakaran

スコア13

test CHANGED
File without changes
test CHANGED
@@ -68,6 +68,24 @@
68
68
 
69
69
 
70
70
 
71
+ コマンドプロンプト実行結果
72
+
73
+ ```cmd
74
+
75
+ >>> python exercise.py hoge fuga
76
+
77
+ File "<stdin>", line 1
78
+
79
+ python exercise.py hoge fuga
80
+
81
+ ^
82
+
83
+ SyntaxError: invalid syntax
84
+
85
+ ```
86
+
87
+
88
+
71
89
  以上のコードは以下のサイトより引用しました。
72
90
 
73
91
  [リンク内容](https://www.python.ambitious-engineer.com/archives/40)

4

情報の編集

2020/04/16 14:54

投稿

python_wakaran
python_wakaran

スコア13

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  ```python
32
32
 
33
- C:/Users/重松 遼太/Python/exercise.py
33
+ C:/Users/ユーザー名/Python/exercise.py
34
34
 
35
35
  Traceback (most recent call last):
36
36
 

3

文法の編集

2020/04/16 13:33

投稿

python_wakaran
python_wakaran

スコア13

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- sample.py
9
+ exercise.py
10
10
 
11
11
  ```python
12
12
 
@@ -52,7 +52,7 @@
52
52
 
53
53
  ```python
54
54
 
55
- python sample.py hoge fuga
55
+ python exercise.py hoge fuga
56
56
 
57
57
  sample.py
58
58
 

2

個人情報を消しました

2020/04/16 13:30

投稿

python_wakaran
python_wakaran

スコア13

test CHANGED
File without changes
test CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  Traceback (most recent call last):
36
36
 
37
- File "C:/Users/重松 遼太/Python/exercise.py", line 5, in <module>
37
+ File "C:/Users/ユーザー名/Python/exercise.py", line 5, in <module>
38
38
 
39
39
  print(args[1])
40
40
 

1

実行結果をのせました

2020/04/16 13:28

投稿

python_wakaran
python_wakaran

スコア13

test CHANGED
File without changes
test CHANGED
@@ -26,9 +26,29 @@
26
26
 
27
27
 
28
28
 
29
+ 実行結果
30
+
31
+ ```python
32
+
33
+ C:/Users/重松 遼太/Python/exercise.py
34
+
35
+ Traceback (most recent call last):
36
+
37
+ File "C:/Users/重松 遼太/Python/exercise.py", line 5, in <module>
38
+
39
+ print(args[1])
40
+
41
+ IndexError: list index out of range
42
+
43
+ ```
44
+
45
+ 何のリストも渡していないので以上のようになります。
29
46
 
30
47
 
48
+
49
+
50
+
31
- 実行結果
51
+ 実行したいこと
32
52
 
33
53
  ```python
34
54
 
@@ -42,7 +62,9 @@
42
62
 
43
63
  ```
44
64
 
65
+ とするにはどこでどのようにコマンドライン引数を渡せばよいか教えてほしいです。
66
+
45
- とするにはどうしますか?よろしくお願いします。
67
+ よろしくお願いします。
46
68
 
47
69
 
48
70