importlib: import X as Y; from A import B

Dieter Maurer dieter at handshake.de
Sun Aug 9 13:00:54 EDT 2020


Jason Friedman wrote at 2020-8-8 21:23 -0600:
> ...
>The cherry-on-top would be to import with the "aliasing" and "from" they
>will most likely see on the web, so that my code matches what they see
>there. In other words, instead of:
>
>import pandas
>df = pandas.from_csv (...)
>import selenium
>browser = selenium.webdriver.Firefox()
>
>on the web they will typically see:
>
>import pandas as pd

import pandas; pd = pandas

>df = pd.from_csv (...)
>from selenium import webdriver

import selenium.webdriver; webdriver = selenium.webdriver
>
>I don't see anything in the importlib module documentation that supports
>this.


More information about the Python-list mailing list