I'm trying to parse a pipe delimited file and pass the values into a list, so that later I can print selective values from the list.
The file looks like:
name|age|address|phone|||||||||||..etc
It has more than 100 columns.
I'm trying to parse a pipe delimited file and pass the values into a list, so that later I can print selective values from the list.
The file looks like:
name|age|address|phone|||||||||||..etc
It has more than 100 columns.
If you're parsing a very simple file that won't contain any
|
characters in the actual field values, you can usesplit
:Use the csv library.
First, register your dialect:
Then, use your dialect on the file:
This will store the file in dataframe. For each column you can apply conditions to select the required values to print. It takes a very short time to execute. I tried with 111047 rows.