您需要使用Javascript找出URL,并将其传递给IPython内核:
from IPython.display import HTMLHTML(''' <script type="text/javascript"> IPython.notebook.kernel.execute("URL = '" + window.location + "'") </script>''')要么:
%%javascriptIPython.notebook.kernel.execute("URL = '" + window.location + "'");然后在下一个单元格中:
print(URL)
之后,您可以使用标准库中的工具(或纯字符串操作)提取查询参数。



