teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

問題のコード追加(修正)

2020/07/04 08:57

投稿

skysoul
skysoul

スコア111

title CHANGED
File without changes
body CHANGED
@@ -9,13 +9,14 @@
9
9
 
10
10
  ↑それをすると、
11
11
 
12
- ```RuntimeError: threads can only be started once```
12
+ ``RuntimeError: threads can only be started once``
13
13
 
14
14
  というエラーが出ます。
15
15
 
16
16
  よろしくお願いします。
17
17
 
18
18
  問題のコード
19
+
19
20
  ```python
20
21
  import time
21
22
  import threading

1

問題のコード追加

2020/07/04 08:57

投稿

skysoul
skysoul

スコア111

title CHANGED
File without changes
body CHANGED
@@ -13,4 +13,24 @@
13
13
 
14
14
  というエラーが出ます。
15
15
 
16
- よろしくお願いします。
16
+ よろしくお願いします。
17
+
18
+ 問題のコード
19
+ ```python
20
+ import time
21
+ import threading
22
+
23
+
24
+ def func1():
25
+ time.sleep(1)
26
+ print("func1")
27
+
28
+
29
+ thread_1 = threading.Thread(target=func1)
30
+
31
+
32
+ thread_1.start()
33
+ thread_1.start()
34
+
35
+
36
+ ```