How to handle '-' in the 'from' part in a "from import" statement?
DL Neil
PythonList at DancesWithMice.info
Tue Oct 8 23:50:01 EDT 2019
On 9/10/19 4:34 PM, jfong at ms4.hinet.net wrote:
> jf... at ms4.hinet.net於 2019年10月8日星期二 UTC+8上午10時45分36秒寫道:
>> For example:
>> from my-dir import test
>>
>> I know it can be solved by renaming, but any alternative?
>>
>> --Jach
>
> Maybe another (better?) solution is:
> import sys
> sys.path.append(r'my-dir')
> import test
Another option might be to add a symlink* from the application's
directory to wherever you've downloaded and expanded the GitHub .zip
archive.
* Linux terminology, other OpSys may use different.
Both are somewhat unattractive (IMHO).
--
Regards =dn
More information about the Python-list
mailing list