当前位置: 动力学知识库 > 问答 > 编程问答 >

python - python3-invalid syntax on a line that do not exist

问题描述:

python3-invalid syntax error

File "6_1.py", line 8

SyntaxError: invalid syntax

But there is no line 8. So what is the problem.

import zipfile,re

with ZipFile('../../下载/channel.zip') as myzip:

nothing = '90052'

rex = re.compile(r'\d+')

while True:

print(myzip.getinfo(nothing+'txt'))

nothing = re.findall(rex, myzip.open(nothing+'txt')[0]

网友答案:

No, but Python thinks there should be because line 7 is not complete:

nothing = re.findall(rex, myzip.open(nothing+'txt')[0]        
#              open 1 -------- open 2 ----- close 2 - ^ where is close 1?

There is a closing ) missing at the end.

分享给朋友:
您可能感兴趣的文章:
随机阅读: