有两个列表,我需要把对应的元素拼接起来.
['192.168.111.116', '192.168.110.285', '192.168.110.184']
['3306', '3307', '3307']
要拼接成 192.168.111.116:3306
def getMasterHost(buff,informationId):
masterHostTmp = re.findall(r"Master_Host:\s*(.*?)\s*Master_User",buff)
masterPortTmp = re.findall(r"Master_Port:\s*(\d*?)\s*Connect_Retry",buff)
print("输出该从库的主库源信息:")
print(masterHostTmp)
print("输出该从库的主库端口信息:")
print(masterPortTmp)
listTmp = []
for i in range(0,len(masterHostTmp)):
listTmp.append(masterHostTmp[i]+":"+masterPortTmp[i])
print(listTmp)
从mysql的show slave status\G;截取出多源从库的新主库信息.
网友评论