AttributeError: 'list' object has no attribute 'strip'

后端 未结 2 1130
日久生厌
日久生厌 2020-12-22 07:31

The following code is causing AttributeError: \'list\' object has no attribute \'strip\' and I do not how to fix it:

#!/usr/bin/env python
from __future__ im         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 08:01

    parts = (line.split(',') for line in f) strip when you split as you are creating lists with split:

    parts = (line.strip().split(',') for line in f)
    

提交回复
热议问题