Python 从csv文件读取时,如何将多个值保存到列表中?

Python 从csv文件读取时,如何将多个值保存到列表中?,python,list,csv,Python,List,Csv,我能够从我的csv文件中读取我的数据列表,当我自己打印它时,它会将它作为列表输出到自己的行中: ['51-4678119', 'Issie', 'Scholard', '11 Texas Court', 'Columbia', 'Missouri', '65218', '3', '134386.51', '34', '91.06'] ['68-9609244', 'Jed', 'Netti', '85 Coolidge Terrace', 'San Antonio', 'Texas', '782

我能够从我的csv文件中读取我的数据列表,当我自己打印它时,它会将它作为列表输出到自己的行中:

['51-4678119', 'Issie', 'Scholard', '11 Texas Court', 'Columbia', 'Missouri', '65218', '3', '134386.51', '34', '91.06']
['68-9609244', 'Jed', 'Netti', '85 Coolidge Terrace', 'San Antonio', 'Texas', '78255', '2', '159648.55', '47', '45.7']
['47-2771794', 'Galvan', 'Solesbury', '3 Drewry Junction', 'Springfield', 'Illinois', '62794', '2', '91934.89', '39', '47.92']
['11-0469486', 'Reynard', 'Lorenzin', '3233 Spaight Point', 'Houston', 'Texas', '77030', '1', '87578.56', '27', '86.84']
我希望能够将out的所有内容放入自己的列表中。 以下是我目前的代码:

import csv
empList = []
with open ('employees.csv') as employees:
    reader = csv.reader(employees)
    header = next(reader)
    if header != None:
        for row in reader:
            print(row)
.append()
方法将在列表末尾添加一个新项。如果用
empList.append(row)
替换打印(row),然后用
print(empList)
替换打印(row),您将得到一个列表,其中包含一组列表

import csv
empList = []
with open (r'desktop\employees.csv') as employees:
    reader = csv.reader(employees)
    header = next(reader)
    if header != None:
        for row in reader:
            empList.append(row)
            
print(empList)
对于以下返回:

['68-9609244'、'Jed'、'Netti'、'85 Coolidge Terrace'、'San Antonio'、'Texas'、'78255'、'2'、'159648.55'、'47'、'45.7']、['47-2771794'、'Galvan'、'Solesbury'、'3 Drewry Junction'、'Springfield'、'Illinois'、'62794'、'2'、'91934.89'、'39'、',['11-0469486','Reynard','Lorenzin','3233 Spaight Point','Houston','Texas','77030','1','87578.56','27','86.84']

您想要
雇主附加(行)