Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
11
Task/CSV-data-manipulation/Python/csv-data-manipulation.py
Normal file
11
Task/CSV-data-manipulation/Python/csv-data-manipulation.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import fileinput
|
||||
|
||||
changerow, changecolumn, changevalue = 2, 4, '"Spam"'
|
||||
|
||||
with fileinput.input('csv_data_manipulation.csv', inplace=True) as f:
|
||||
for line in f:
|
||||
if fileinput.filelineno() == changerow:
|
||||
fields = line.rstrip().split(',')
|
||||
fields[changecolumn-1] = changevalue
|
||||
line = ','.join(fields) + '\n'
|
||||
print(line, end='')
|
||||
Loading…
Add table
Add a link
Reference in a new issue