在代码中添加标题?第一个标题工作和第二个标题工资

时间:2018-06-10 09:12:43

标签: python excel csv

学习python

    import re
    x="job"
    filename="jobprofiles.txt"
    job=[]
    salary=[]
    with open(filename, "rt") as in_file:
              for line in in_file:
               line = line.translate(none, "!")
                        if x in line:
                            job.append((line[line.find(x)+len(x):]].strip())
    import re
    x="salary"
    filename="jobprofiles.txt"
    with open(filename, "rt") as in_file:
        for line in in_file:
           line = line.translate(none, "!")
           if x in line:
                  salary.append((line[line.find(x)+len(x):]].strip())
   for i in range(1,len(job)):
   print job[i-1]+ ","+ir[i-1] 

我的示例输出:

会计师,32000 VET,42000 金融,40000 老师,25000 商业,32000 医生,45000

我如何添加标题? 例如 JOB SALARY 会计,32000 VET,42000 金融,40000 老师,25000 商业,32000 医生,45000

0 个答案:

没有答案