How to handle '-' in the 'from' part in a "from import" statement?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Tue Oct 8 23:34:07 EDT 2019


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

--Jach



More information about the Python-list mailing list