Pythonとは?
- 読み方
- ぱいそん
- 最終更新
- 2026/10/14
3秒でわかる
30秒図解
Pythonをたとえると?
レシピを
実際にはこう使います
もう少し詳しく
Python は、
まず、よくある誤解
誤解 「インデント (字下げ) は、
本当は Python では、
どういうものか
Python は、print("こんにちは") の 1 行で画面に{} の
ファイルの
なぜ必要か
書く
具体例
prices = [1200, 800, 450]
total = 0
for price in prices:
total += price # 字下げした行が for の中身
print(total) # 2450 (字下げなし = for の外)最後の print を 1 段字下げすると
つまずきやすいところ
字下げの
古い記事の print "hi" のような
似た用語との違い
| 言語 | 特徴 |
|---|---|
| Python | 字下げで |
| JavaScript | ブラウザや Node.js で |
| Java | ふつうは |
よくある質問
Pythonのインデントは何文字ですか?
同じまとまりの中でそろっていれば動きますが、公式のスタイルガイド PEP 8 は 1 段を空白 4 つにすることを勧めています。
Python 2とPython 3のどちらを学べばよいですか?
Python 3 です。Python 2 は 2020 年 1 月 1 日で開発とサポートが終わっています。
一次情報・内容確認
The Python Tutorial 3.2 First Steps Towards Programming
Python Documentation
The Python Language Reference 2.1.8 Indentation
Python Documentation
PEP 20 The Zen of Python
Python Software Foundation
PEP 8 Style Guide for Python Code
Python Software Foundation
Sunsetting Python 2
Python Software Foundation
The Python Tutorial 10 Brief Tour of the Standard Library
Python Documentation


