简体   繁体   中英

IndentationError: expected an indented block where?

 File "<ipython-input-9-80002b11f2f7>", line 16
    linest = i.strip().split(",")
    ^

dont know what to do or where i have to set line 16?

with open("names.csv", "r") as file:
    
    name = "Annie"
    state = "AK"
    gender = "F"
    
    xs = []
    ys = []
    
    counter = 0
    
    for i in file:
        counter += 1
        if counter >= 5:
      
        linest = i.strip().split(",")
        
        if linest[1] == name and linest[4] == state and linest[3] == gender:
            print (linest)
        
        xs.append(linest[1])
        ys.append(linest[3])
        
        print(xs)
        print(ys)

There is nothing inside the if counter >= 5: statement. That's why you have an indentation error. Insert a pass statement or some other code there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM