有一个问题循环遍历两个不同长度的列表并进行比较。我需要做的是检查文件是否已作为附件存在。所以我试图找到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: