我试图弄清楚luxon为什么无法解析此日期格式。
这是我的原始值:# normal function definition
#
def function():
string = "string"
print(string)
# multi-line
#
new_func = """
def do_stuff():
string = 'strung' # I don't know how to include the other line here
print(string)"""
# single line, note the presence of \n AND \t
#
new_func2 = "def do_stuff2():\n\tstring = 'strong'\n\tprint(string)\n"
new_code = compile(new_func, "", 'exec')
new_code2 = compile(new_func2, "", 'exec')
eval(new_code)
eval(new_code2)
function()
do_stuff()
do_stuff2()
。
这是什么格式(看起来像iso格式)。
代码段:
import pandas as pd
import bs4 as bs4
import requests
from requests_html import HTMLSession
if __name__ == "__main__":
my_url = "https://ru.wikipedia.org/wiki/%D0%9C%D0%B5%D0%B6%D0%B4%D1%83%D0%BD%D0%B0%D1%80%D0%BE%D0%B4%D0%BD%D1%8B%D0%B9_%D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81_%D1%81%D1%87%D0%B0%D1%81%D1%82%D1%8C%D1%8F"
session = HTMLSession()
my_page = session.get(my_url)
data = pd.read_html(my_page.text, flavor="bs4", header=0)
for item in data:
print(item)
以上代码段的输出:
2019-04-23T23:15:07.910Z
答案 0 :(得分:0)
啊,终于明白了。原来2019-04-23T23:15:07.910Z
实际上是一个JavaScript日期对象。
这意味着我需要做const fromJSDate = DateTime.fromIJSDate(document.lastUpdatedAt)