简体   繁体   中英

Python Relative File Importing

First off I want to apologize if this question has been posted numerous times, but the solutions I have been reading such as ( python relative import ) haven't really answered the question I am about to ask (or rather I don't understand how to apply this answer to my scenario). So basically I have two folders: AR and CL. In AR there is a file named "Around.py" and in CL there is a file called "Clear.py". How would I go about importing "Around.py" into "Clear.py".

在此处输入图片说明

NOTE: Assume I cannot use absolute paths as a solution (so please don't use them in the solution), but relative path importing is OK.

Any help would be greatly appreciated!

如果AR和CL文件夹位于同一文件夹中,那么下面的内容应该可以从Clear.py中使用:

from ..AR import Around

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM