【发布时间】:2011-12-26 10:03:45
【问题描述】:
这是我的代码...我收到缩进错误,但我不知道为什么会发生。
->
# loop
while d <= end_date:
# print d.strftime("%Y%m%d")
fecha = d.strftime("%Y%m%d")
# set url
url = 'http://www.wpemergencia.omie.es//datosPub/marginalpdbc/marginalpdbc_' + fecha + '.1'
# Descargamos fichero
response = urllib2.urlopen(url)
# Abrimos fichero
output = open(fname,'wb')
# Escribimos fichero
output.write(response.read())
# Cerramos y guardamos fichero
output.close()
# fecha++
d += delta
【问题讨论】:
-
没有
IndentationError here。它必须与d和end_date的定义一起在您的代码中的其他位置。请提供SSCCE。 -
任何半体面的编辑器都可以选择以某种方式直观地显示空格和制表符。使用它。
-
已将标签更改为空格,现在应该可以复制了。
标签: python indentation