python爬取两个excel表⾥的相同数据并匹配输出
import xlrd
def extract(inpath):
data = xlrd.open_workbook(inpath, encoding_override='utf-8')
高层建筑规范table = data.sheets()[0]  # 选定表
nrows = ws  # 获取⾏号
ncols = ls  # 获取列号
all_info =[]
teacher =getnew(inpathnew)
print(teacher)
# print(nrows)
for i in range(0, nrows):  # 第0⾏为表头
if i ==10:
break
了不起的挑战第二季
else:
第一届奥运会是哪一年
alldata = w_values(i)  # 循环输出excel表中每⼀⾏,即所有数据
result = alldata[0]+'、'+ alldata[1]+'、'+ alldata[2]+'、'+ alldata[3]+'、'+ alldata[4]  # 取出表中第⼆列数据
name ='刘诗诗'
data = name in result
if data:
index = i
最终幻想4 ios 攻略same_name = name
#print(result)
def getnew(inpathnew):
data = xlrd.open_workbook(inpathnew, encoding_override='utf-8')
table = data.sheets()[0]  # 选定表
nrows = ws  # 获取⾏号
ncols = ls  # 获取列号
all_info =[]
for i in range(1, nrows):  # 第0⾏为表头
alldata = w_values(i)  # 循环输出excel表中每⼀⾏,即所有数据
result = alldata
#result = alldata[0]+'、'+ alldata[1]+'、'+ alldata[2]+'、'+ alldata[3]+'、'+ alldata[4]+'、'+ alldata[5]  # 取出表中第⼆列数据        all_info.append(result)
print(all_info)
#all_info =(2,5,8,10,8,12,23,3,2,3,5)
import itertools
original_list = all_info
new_merged_list =list(itertools.chain(*original_list))
print(new_merged_list)
arr = new_merged_list
print(arr)
n =len(arr)
地摊网站for i in range(0, n):
for j in range(i +1, n):
if(arr[i]== arr[j]):
print("%s,%s"%(arr[i], arr[j]))
为什么男人喜欢捏胸
# # 定义列表
# l =["a","b","c","a","b","c","a"]
# # 获取第⼀个"a"的下标
# index_one = l.index("a")
# # 从第⼀个"a"的下⼀个位置开始查,所以加1
# print(l.index("a", index_one +1))
#return all_info
#return all_info
inpath =("111.xlsx")  # excel⽂件所在路径inpathnew =("222.xlsx")  # excel⽂件所在路径#extract(inpath)
getnew(inpathnew)