import ConfigParser
import os

path = os.path.join(os.path.dirname(__file__), 'config.ini').replace('\\','/')
print path

# config = ConfigParser.ConfigParser()
# config.read('config.ini')
# config.read(path)

# print config.sections()

conf = ConfigParser.ConfigParser()

#载入配置文件
conf.read('112.ini')

print conf.sections()

ini文件需要和脚本在同一个目录下,不在的话则会显示为空。这个问题小弟搞不懂,于是一直出错。

Python  自动化测试config配置文件ini 配置目录


 
                    
            
                

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2021-12-26
  • 2019-11-26
  • 2021-10-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案