python unexpected indent 問題

代碼
import matplotlib.pyplot as plt
import numpy as np
filename='E:\1Documents\pmodlh\antenna and instrument\20170627-20180630\Cool_Temp_20170627.dat'
x,y,z,m=[],[],[],[]
with open(filename,'r') as f:
    lines=f.readlines()
	for line in lines:
		value=[float(s) for s in line.split()]
		x.append(value[0])
		y.append(value[1])
		z.append(value[2])
		m.append(value[3])
		
print x

 File "C:\Users\Administrator\Documents\Python Scripts\data_plot.py", line 7
   for line in lines:
   ^
ndentationError: unexpected indent
解決方法:

notepad++

視圖——顯示符號——顯示空格與製表符,TAB鍵對齊。

注:python 對縮進有嚴格的要求。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章