Attribute Error: 'list' object has no attribute 'split'

前端 未结 3 562
感动是毒
感动是毒 2020-11-29 01:25

I am trying read a file and split a cell in each line by a comma and then display only the first and the second cells which contain information regarding the latitude and th

3条回答
  •  一个人的身影
    2020-11-29 01:40

    The problem is that readlines is a list of strings, each of which is a line of filename. Perhaps you meant:

    for line in readlines:
        Type = line.split(",")
        x = Type[1]
        y = Type[2]
        print(x,y)
    

提交回复
热议问题