Skip to content

v2.6.0

Compare
Choose a tag to compare
@ryuichiueda ryuichiueda released this 02 Jul 04:33
· 8 commits to master since this release

-t csv option is added to this version. This option makes opy reads a CSV file entirely. The CSV data is stored to the default dictionary T. Followings are example.

### read a csv data and print the dictionary ### 
$ echo -e 'a,b,c\nd,e,f'
a,b,c
d,e,f
$ echo -e 'a,b,c\nd,e,f' | opy -t csv '[T]'
{0: ['a', 'b', 'c'], 1: ['d', 'e', 'f']}
### print an element ###
$ echo -e 'a,b,c\nd,e,f' | opy -t csv '[T[1][1]]' 
e

The csv module can handle an element that contains newline charactes.

$ echo -e 'a,b,"c\nd",e,f'
a,b,"c                             <- this is **one-line** csv data ( "c\nd" is an element.) 
d",e,f
$ echo -e 'a,b,"c\nd",e,f' | opy -t csv '[T[0][2]]'
c
d