0
0

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 1 year has passed since last update.

pythonでほかのスクリプトファイルを呼び出す方法と変数をほかファイルから呼び出す方法

Posted at

短く書く。

呼び出すにはimportを使う

// コードA
print ("Hello, World!")
// コードB
import CodeA

変数を呼び出すにはimportを使う。そして、呼び出す側にも変数を作り、中身は コードの名前.変数名 のような形式にする。

// コードA
variabletest = Hello, World!
// コードB
import CodeA
hensu = CodeA.variabletest
print (hensu)
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?