<> Method 1 :

Project name :InterfaceTest_master, root directory :InterfaceTest_master/
# Gets the directory of the current file cur_path = os.path.abspath(os.path.dirname(__file__)) # Get root directory
root_path= cur_path[:cur_path.find("InterfaceTest_master\\")+len(
"InterfaceTest_master\\")] print(root_path) # Create another directory data_path = os.path.abspath
(root_path +'\\excelReport') if not os.path.exists(data_path): os.mkdir(
data_path) # If this doesn't exist excelReport folder , Create one automatically print(data_path)
<> Operation results :
C:\Users\Administrator\Desktop\InterfaceTest_master\ C:
<> Method 2 :
# Get root directory base_dir = dirname(dirname(abspath(__file__))) print(base_dir) #
Revised to linux catalog base_dir = base_dir.replace('\\', '/') print(base_dir) # Create another directory
file_path= base_dir + "/excelReport" print(file_path)
<> Operation results :
C:\Users\Administrator\Desktop\InterfaceTest_master C:/Users/Administrator/
Desktop/InterfaceTest_master C:/Users/Administrator/Desktop/InterfaceTest_master

©2020 ioDraw All rights reserved
Vue The difference between single page and multi page 0.96OLED display -4 Line SPI explain R In language Axis() Detailed explanation of function parameters JAVA Snake games ( Source code + notes )C++ vector Simulation Implementation of class javascript Adding and deleting form information CCF A series of questions --2016 year 4 Month 1 Calculation of break point postman Interface test get timestamp and MD5 encryption 【 Recommended benefits 】c++ use easyx Making pixel birds , Simple hands on games TCP/IP There are so many loopholes in the agreement ?