Python:具有相同值的两个字符串如何不可能相同?

时间:2017-03-30 04:01:09

标签: python

我有以下字符串:' google.com'

我正在从文件中读取字符串:

with open("ip_hostnames.txt", "r") as file_hosts:
    "Reading IPs..."
    for line in file_hosts:
        line = line.replace("\n", "")
        split_line = line.split(',')
        hostname = split_line[0]
        ip = split_line[1]
        # output_lines.append(get_ssl_cert(hostname))
        output_lines.append(run_cert(hostname.strip(' \t\n\r'), ip.strip(' \t\n\r')))

调用函数:

def run_cert(hostname, ip):
    host = 'google.com'
    cert = CertInfo(host=hostname, port=443)  # ('RC4-SHA', 'TLSv1/SSLv3', 128)
    info = cert.cipher()

我收到错误,因为服务器名称google在以下内容中无效(从文件中读取):

google.com, 74.125.196.101
google.com, 74.125.196.138

我已经做了一些挖掘,用hostname替换host来解决问题,但它们实际上是完全相同的字符串。人眼与这些字符串完全没有区别,但出于某种原因,python说它们是假的:

enter image description here

这怎么可能?

0 个答案:

没有答案