파일에서 데이터를 읽습니다. 데이터 파일의 대부분의 데이터는 수정없이 출력 파일에 읽고 쓰여집니다. 그러나 그 자리에서 데이터는 5 개의 다른 쓸모없는 줄 앞에 오는 빈 줄로 구분됩니다.Python : 파일을 읽을 때 구문 오류가 발생했습니다.
File "convert.py", line 31
elseif testline == '\n':
^
SyntaxError: invalid syntax
어떤 생각을 : 나는 나를 난처한 상황에 빠진 다음과 같은 오류가
#Now loop over the entire file
while True:
testline = infile.readline()
if len(testline) ==0:
break # EOF
elseif testline == '\n':
for i in range(0,5)
testline = infile.readline()
else:
outfile.write(testline)
: 여기 내 코드는? 나는 elseif 문에 무엇이 잘못되었는지 알 수 없다.
Python에는 'elseif'가 없습니다. 당신은'엘프 '를 원합니다. –