pyp

Python one-liner (converting perl to pyp)

拈花ヽ惹草 提交于 2020-01-03 10:59:21
问题 I was wondering if its possible to make a one-liner with pyp that has the same functionality as this. perl -l -a -F',' -p -e'if ($. > 1) { $F[6] %= 12; $F[7] %= 12;$_ = join(q{,}, @F[6,7]) }' This takes in a comma separated list of numbers with 8 numbers per line and outputs it in the same format except the last two numbers in each line are reduced modulo 12. It also outputs the first line (the header line) verbatim first. I have quite a lot of these obscure perl one-liners and I would like

Python one-liner (converting perl to pyp)

那年仲夏 提交于 2020-01-03 10:59:06
问题 I was wondering if its possible to make a one-liner with pyp that has the same functionality as this. perl -l -a -F',' -p -e'if ($. > 1) { $F[6] %= 12; $F[7] %= 12;$_ = join(q{,}, @F[6,7]) }' This takes in a comma separated list of numbers with 8 numbers per line and outputs it in the same format except the last two numbers in each line are reduced modulo 12. It also outputs the first line (the header line) verbatim first. I have quite a lot of these obscure perl one-liners and I would like