Perl to Python - CSV cleaning -


I have to be forced to turn on the python from Pearl, took a course too, I am struggling with cleaning work. I want to change a bisect by a space in a particular column, the other columns should be untouched:

In Pearl it is very straight forward and works like a magic:

< Pre> pearl-f ";" -Len '$ {$, = ";"} Print $ F [0], $ F [1], $ F [2], $ F [3], $ F [4], $ F [5], $ F [6], $ F [7], $ F [8], $ F [9], $ F [10], $ F [11], $ F [12] = ~ s / \ ¶ / $ F [13] 'a.csv

How can I do Python? It does not have to be a traveler ...

This can be done in a row (but this It will be difficult to understand). Here is a slightly more verbose example.

  import io import again as wing in the form of io.open ('a.csv'): for the line in the fan: parts = line.split (';') parts [13] = Parts [13] ('¶', '') Print ','. Joining (parts)  

Comments