import configparser
#配置对象
config = configparser.ConfigParser()
config.read('/Users/tophan/PycharmProjects/ATM+ 购物车/conf/setting.ini')#如果不是绝对路径,在其他地方调用该settings时,找不到setting.ini路径
BASE_PATH = config.get('section1', 'BASE_PATH')
print(BASE_PATH) #/Users/tophan/PycharmProjects/ATM+ 购物车
DB_PATH = config.get('section1', 'DB_PATH')
print(DB_PATH) #/Users/tophan/PycharmProjects/ATM+ 购物车/db