Get the inputs from Excel and use those inputs in python script

后端 未结 4 1340
予麋鹿
予麋鹿 2021-01-16 14:23

How to get the inputs from excel and use those inputs in python.

4条回答
  •  悲哀的现实
    2021-01-16 14:54

    If you can save as a csv file with headers:

    Attrib1, Attrib2, Attrib3
    value1.1, value1.2, value1.3
    value2,1,...
    

    Then I would highly recommend looking at built-in the csv module

    With that you can do things like:

    csvFile = csv.DictReader(open("csvFile.csv", "r"))
    for row in csvFile:
        print row['Attrib1'], row['Attrib2']
    

提交回复
热议问题