看板 Python 關於我們 聯絡資訊
>>> import urllib.request as url >>> fh = url.urlopen('http://www.tzuchi.org.tw') >>> content = fh.read().decode('utf-8') >>> with open('test','w') as fd: ... fd.write(content) File "<stdin>", line 2 fd.write(content) ^ IndentationError: expected an indented block >>> fd.write(content) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'fd' is not defined >>> 請問IndentationError是什麼意思?是慈濟網站阻擋下來了嗎? -- http://dicky.twbbs.org/ ╔O ╔╗+  ╭╮O  ╔╗╔╗ ★ O ║║ ║║   ╰╯。  O║║║。O   ║║ ║║╔═O╦╦═╗O║╚╝╠═╦╦╗ ║║☆║╚╣║║│║╩╣ ╚╗╔╣║║║║ ╚╝ O═╩═╩═╩═╝★ ╚╝╚═╩═O -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.36.82
tiefblau:...就indent錯阿= = 寫py一定要好好縮排 10/13 22:40
alex0914:少個tab... 10/13 22:58
milkdicky:謝謝樓上兩位。 10/13 23:04
lc85301:XDDD,合理懷疑你沒選個會自動縮排的工具lol 10/14 00:02
ck574b027:看起來就是用內建 cmd line 打的啊 10/14 00:15
milkdicky:我是直接在終端機打的,請問會自動縮排的工具有哪些? 10/14 08:04
ming1053:ipython 10/14 08:48