美文网首页
python 两个列元素拼接

python 两个列元素拼接

作者: 随便写点什么就好 | 来源:发表于2020-07-06 15:26 被阅读0次

有两个列表,我需要把对应的元素拼接起来.
['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;截取出多源从库的新主库信息.

相关文章

网友评论

      本文标题:python 两个列元素拼接

      本文链接:https://www.haomeiwen.com/subject/rxawqktx.html