从字符串转换ISO时间(本地时间在2018年10月23日09:18的条件)

时间:2018-10-23 08:29:40

标签: python time beautifulsoup

我正在从一个以这种格式定义时间的网络中收集数据。本地时间为2018年10月23日09:18的条件。基于给定的格式,我想将其转换为ISO格式。

为了摆脱多余的文字,我采用了这种方法:

    soup = BeautifulSoup(homePage.content, 'html.parser')        
    time1 = soup.find("caption")
    time2 = time1.get_text().split()
    filtter = ["Conditions", "at", "local", "time", "on"]
    for m in  time2:
        #print(m)
        if m not in filtter:
            test = m
            print(test.split)

此代码的结果如下:

09:24
23
October
2018

有人可以在这里引导我吗?

谢谢

0 个答案:

没有答案