
Photo by
bluewaters
プロンプトでの「help」とショートカットキー「Alt」+「P
今日は、『Head First Python』の1章 “基本” で学んだことをアウトプットします。
インタプリタに助けを求める
IDLEのシェルは、Pythonドキュメントから調べたい名前に関するセクションを表示する機能を持っています。
>>>プロンプトでrandomモジュールのrandint関数のヘルプを要求してみます。
>>> help(random.randint)
Help on method randint in module random:
randint(a, b) method of random.Random instance
Return random integer in range [a, b], including both end points.
randint関数については、以前にも投稿したことがあります。
「Alt」+「P」で直前に入力したコマンドを表示
ここでは、>>>プロンプトで何回か試してみることにします。その際、IDLEの>>>プロンプトでは、「Alt」+「P」を押すと、直前に入力したコマンドを表示させることができます。「P」は「previous(前の)」という意味です。
いいなと思ったら応援しよう!
