Jan-23-2017, 02:53 PM
Hi guys,
I need to clean a file with 13 millions lines. Some lines don't has value on the third column, so I need to exclude them.
Here's an input example:
I need to clean a file with 13 millions lines. Some lines don't has value on the third column, so I need to exclude them.
Here's an input example:
Output:-8.17641148055556 54.4510540761111 -178.44
-8.17642712805556 54.4511079527778 -178.29
-8.17644273722222 54.4511528463889
-8.176458385 54.4512067233333
-8.17648941 54.4512515941667
This is the desired output:Output:-8.17641148055556 54.4510540761111 -178.44
-8.17642712805556 54.4511079527778 -178.29
Here's my code, but it gives me a blank file:#!/usr/bin/env python3 with open('cleancol.txt',"r") as fh, open('cleancol2.txt',"w") as sh: for row in fh: row_list = row.split(' ') if row_list[2].isnumeric(): print(row, file=sh, end='')Thanks for the help !!