- 论坛徽章:
- 0
|
本帖最后由 liumilan2009 于 2013-09-13 11:24 编辑
1
2 f_less = open('less20.txt','w')
3 f_more = open('more20.txt','w')
4
5 for line in open("test"):
6 # line = line.strip()
7 if line.find("start to print")>0 :
8 num = 0
9 word = ""
10 f_less.write(line)
11 f_more.write(line)
12 elif line.find("end to print")>0:
13 if( num <20):
14 f_less.write(word)
15 f_less.write(line)
16 else:
17 f_more.write(word,line)
18 else:
19 num=num+1;
20 word = word+line
21
这时候报 python test.py
File "test.py", line 16
else:
^
IndentationError: unindent does not match any outer indentation level
elif语句后面不能再有else语句吗?怎么改啊? |
|