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

質問編集履歴

4

123

2019/09/06 10:50

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- 2つのpyファイル間変数
1
+ 2つのpyファイル間変数hogeにより受け渡せるか?
body CHANGED
File without changes

3

あdf

2019/09/06 10:50

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -3,12 +3,15 @@
3
3
  main.pyでprint(sub.function.hoge)でthis is testを表示させるにはどうしたらいいのでしょうか?
4
4
 
5
5
  # main.py
6
+
6
- ```ここに言語を入力
7
+ ```
7
8
  # !/usr/bin/env python
8
9
  # coding: utf-8
9
10
  import sub
10
11
  print(sub.function.hoge)
12
+ ```
11
13
 
14
+
12
15
  # sub.py
13
16
 
14
17
  ```

2

あb

2019/09/06 10:36

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -2,12 +2,18 @@
2
2
  以下のように2つのpyファイル間の変数を取得して
3
3
  main.pyでprint(sub.function.hoge)でthis is testを表示させるにはどうしたらいいのでしょうか?
4
4
 
5
+ # main.py
5
6
  ```ここに言語を入力
7
+ # !/usr/bin/env python
6
- # main.py
8
+ # coding: utf-8
7
9
  import sub
8
10
  print(sub.function.hoge)
9
11
 
10
12
  # sub.py
13
+
14
+ ```
15
+ # !/usr/bin/env python
16
+ # coding: utf-8
11
17
  def function():
12
18
  hoge = "this is test"
13
19
  return hoge

1

2019/09/06 10:35

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -9,6 +9,6 @@
9
9
 
10
10
  # sub.py
11
11
  def function():
12
- hoge = 1
13
- return "this is test"
12
+ hoge = "this is test"
13
+ return hoge
14
14
  ```