0
1

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 5 years have passed since last update.

[Python備忘録]import時の記述法について

Posted at

importする際の記述の方法について

Pythonの標準ライブラリや自分たちのパッケージなど、いろいろimportする機会があるが、
どこからインポートしたものなのかわかりやすくする記述法がある。

以下のようにまとめるのが通常のようである。

Python_import.py
import collections          #一番上にPythonの標準ライブラリ
import os                   #アルファベット順になるように
                   #スペースを開けて
import third               #サードパーティのライブラリ

import other_team_package  #会社の他のチームが作ったパッケージなど

import local               #ローカルのファイル

のような順で書くと、どこからインポートされたのかひと目でわかるので便利。

0
1
1

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?