read_file.py 488 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. '''
  4. 使用 csv读取数据
  5. @Auther :liuyuqi.gov@msn.cn
  6. @Time :2018/7/4 16:46
  7. @File :read_file.py
  8. '''
  9. import csv
  10. from configparser import ConfigParser
  11. config_path = "../conf/config.ini"
  12. section_name = "data_file_name"
  13. cf = ConfigParser()
  14. cf.read(config_path)
  15. # app_interference
  16. # app_resources
  17. # instance_deploy
  18. # machine_resources
  19. with csv.reader(cf.get(section_name, "app_interference"), "r") as f:
  20. for line in f:
  21. print(line)