iPython ãèµ·åä¸ã«ã¢ã¸ã¥ã¼ã«ãåèªã¿è¾¼ã¿ãããã
iPython ã§ã¢ã¸ã¥ã¼ã«ã¨ããã¡ã¤ã«èªã¿è¾¼ãã§è²ã 試ããªãããã¨ãã£ã¿ã§ã½ã¼ã¹ãããã£ã¦ã¡ããã¡ããå¤æ´ãã¦ãã£ã¦ãã¨ããããããã ãã©ããã¡ãã¡ iPython åèµ·åï¼å import ããããã¦ãããã§ããã¼ããã©ããã¼ãªã¼ã¨æããªãããã£ã¦ããã§ããªããããæ¹æ³ãªãããªã¼ã¨æ¢ãã¦ã¿ããå®ã¯ã¡ããã¨åèªã¿è¾¼ã¿ããã³ãã³ããã£ãã¿ãããªãã§ã¡ã¢ã
reloadãdreloadãrun ã¨ãã使ããããã£ãã
import Sample ã£ã½ããã¨ãããå ´å
ã¨ãããããreloadãã
In [17]: reload Sample -------> reload(Sample) Out[17]: <module 'Sample' from 'Sample.pyc'>
import ããã¢ã¸ã¥ã¼ã«ã®ä¸ã§ããã«ã¢ã¸ã¥ã¼ã«ã import ãã¦ã¦ãããã¤ããä¸æ°ã« reload ãããå ´åã¯ãdreloadãã使ãã
# Sample ã®ä¸ã§ import random ã ããã¦ãå ´å In [18]: dreload Sample -------> dreload(Sample) Reloading Sample Reloading random Reloading warnings Reloading types Reloading _types Reloading linecache Reloading os Reloading errno Reloading posix Reloading posixpath Reloading stat Reloading UserDict Reloading copy_reg Reloading math Reloading binascii Reloading _random Out[18]: <module 'Sample' from 'Sample.py'>
ãããªæãã
åºæ¬çã« py ãã¡ã¤ã«ã import ãã¦ããå ´å㯠reload ã drelaod ã§ãã¾ãããã
from Sample import * ã£ã½ããã¨ãããå ´å
ãããã£ã¦ import ããã¢ã¸ã¥ã¼ã«ã¨ãé¢æ°ã¯ reload ã dreload ã§ããã¾ãåèªã¿è¾¼ã¿ã§ããªãã
ããããã¨ãã¯ããã¾ããããã¨ãããããã©ãrunãã使ãã¨ãã¾ããã¨åèªã¿è¾¼ã¿ãã¦ãããã¨ããããã
In [22]: %run Sample
ãã ãã¡ã¤ã«ãå®è¡ãã¦ãã ããªãã§æ®éã«å®è¡ãã¦ã¨ã©ã¼ãã§ããã¤ã«ã¯é©ç¨ã§ãããã©ãã
ã㨠Django ã® manage.py shell ã¨ãã§ããã¾ãåãã¦ããããæé«ãªãã ãã©ãªããã©ããåãã¦ãããªããã ããªããããªããããæ¹æ³ãªããããªããã