我收到“ AttributeError:'map'对象没有属性'append'”

时间:2018-11-16 07:12:53

标签: python-3.x python-2.7 facebook facebook-graph-api

我正在尝试从facebook上获取检查数据,整个代码运行良好,我得到了“ AttributeError:'map'对象没有属性'append'

这是主要功能

def main(地名,facebook_fields,csvFileFields,dataFile):

currTime = str(datetime.datetime.now())

graph = facebook.GraphAPI(access_token=TOKEN, version="2.8")

placesData = []

for placeName in placeNames:

    print (placeName)

    placeSearchResults = graph.search(type='place',
                                      q=placeName,
                                      fields=facebook_fields)

    placeData = placeSearchResults['data'][0]


    placeData.update({'time': currTime})

    placesData.append(placeData) // "error"

for placeData in placesData:

    print (placeData['name'])

    placeDataCSVList = []

    for CSVfield in csvFileFields.split(","):

        placeDataCSVList.append(placeData[CSVfield])

        placeDataCSVList = map(str, placeDataCSVList)

    placeDataCSV = ",".join(placeDataCSVList)

    dataFile.write(placeDataCSV + "\n")

dataFile.flush()

0 个答案:

没有答案