给定一个 csv 文件路径 path
,请你读取 csv 文件内容,然后将第一行的 ‘name’ 修改成 ‘student_name’,然后将修改后的内容写回 path
中(请覆盖原来的数据)。
样例一:
输入:
'/output/1.csv'
[['name', 'class', 'age'], ['Hilary', '7', 25], ['Bobby', '1', 24], ['Jesse', '5', 24], ['Jess', '4', 20], ['Kelsey', '7', 23], ['Jules', '10', 22], ['Cody', '5', 24], ['Kerry', '4', 20], ['Kelsey', '6', 23], ['Eden', '2', 22], ['Jule', '3', 24], ['Jess', '5', 21], ['Jule', '10', 19], ['Jules', '10', 24], ['Jessie', '1', 24], ['Joyce', '6', 25], ['Courtney', '10', 19], ['Jordan', '5', 20], ['Jessie', '7', 25], ['Justice', '9', 19], ['Fred', '10', 23], ['Kelly', '5', 19], ['Jule', '10', 24], ['Barrie', '8', 23], ['Asa', '8', 25], ['Garfield', '3', 21], ['Jordan', '8', 22], ['Elisha', '6', 25], ['Justice', '6', 22], ['Kelly', '8', 19], ['Kelsey', '9', 20], ['Jules', '8', 25], ['Gabriel', '4', 19], ['Jule', '8', 22]]
输出:
student_name,class,age
Hilary,7,25
Bobby,1,24
Jesse,5,24
Jess,4,20
Kelsey,7,23
Jules,10,22
Cody,5,24
Kerry,4,20
Kelsey,6,23
Eden,2,22
Jule,3,24
Jess,5,21
Jule,10,19
Jules,10,24
Jessie,1,24
...
样例二:
输入:
'/output/26.csv'
[['name', 'class', 'age'], ['Jerry', '8', 21], ['Beverly', '3', 21], ['Jess', '6', 19], ['Jules', '3', 20], ['Cameron', '10', 21], ['Joey', '3', 23], ['Joey', '1', 19], ['Brady', '8', 23], ['Jules', '6', 19], ['Benny', '9', 22], ['Drew', '4', 25], ['Jessie', '2', 20], ['Kendall', '2', 23], ['Jess', '7', 19], ['Kelsey', '8', 23], ['Joey', '4', 24], ['Joyce', '8', 21], ['Cameron', '9', 21], ['Devin', '4', 25], ['Jordan', '8', 21], ['Kendall', '1', 23], ['Jules', '8', 22], ['Cody', '1', 20], ['Joey', '3', 23], ['Hadley', '8', 22], ['Justice', '4', 23], ['Britton', '6', 19], ['Jan', '2', 19], ['Edie', '4', 24], ['Joyce', '3', 23], ['Dominique', '5', 23], ['Jule', '4', 21], ['Justice', '1', 20], ['Joyce', '8', 22], ['Cherry', '3', 19], ['Carol', '10', 22], ['Kendall', '7', 20], ['Kendall', '8', 21], ['Celestine', '8', 22]
输出:
student_name,class,age
Jerry,8,21
Beverly,3,21
Jess,6,19
Jules,3,20
Cameron,10,21
Joey,3,23
Joey,1,19
...
题目难度:简单
题目来源:LintCode 炼码