将熊猫的列与文件列表相匹配 - 列表的长度不同

时间:2017-12-13 18:14:12

标签: python-3.x api jupyter-notebook arcgis

有一个问题循环遍历两个不同长度的列表并进行比较。我需要做的是检查文件是否已作为附件存在。所以我试图找到pandas名称列中与文件列表中的值匹配的所有值跳过这些值并继续附加其余值。

            for root, dirs, files in os.walk(attachmentFolder): 
            for filename in files:
                #create dataframe of existing attachments
                df2 = pd.DataFrame(featureAttachments)
                df2.reset_index() 
                #iterate through attachments to find names
                for row in df2.itertuples():
                    attName = (row.name)
                    parentid = (row.parentGlobalId)
                    #if existing attachment matches a filename
                    if filename == attName:
                        print('Attachment:{} already exists.'.format(attName))

                    else:

0 个答案:

没有答案
相关问题