LoginSignup
7
7

More than 5 years have passed since last update.

pythonインタプリタ起動時に良く使うmoduleをimportする

Posted at

-i オプションを付けて起動すると、起動時にファイルを読みこんだ後に、対話モードに入る。
よくimportする基本的なモジュールのimport宣言をまとめて記述しておくと楽ちんになる。

myStartup.py
import os
import datetime
import hogehoge
import .....

のようなファイルを用意しておき
以下のように -i オプション付きでインタプリタを起動すれば良い。
ipythonでも使える。

python -i myStartup.py
7
7
2

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
7
7