import numpy as numpy
import operator as operator
import sys
import string
def func(a,v):
with open(a, 'r') as f:
a=f.read()
with open(v, 'r') as f:
v=f.read()
a=a.split(',')
a=list(map(int,a))
v=v.split(',')
v=list(map(int,v))
hfg=numpy.correlate(a, v,'full')
max_index, max_number = max(enumerate(hfg), key=operator.itemgetter(1))
return max_index,max_number
print(func("c:\\22\\js.txt","c:\\22\\os.txt"))
1. 从两个文件中读取数组的字符串
2. 用, 分割成字符串数组,再转成整数数组
3. 请两个数组的互相关
4. 得到最大值的序号和最大值