perl to python

Kirk Job-Sluder kirk at eyegor.jobsluder.net
Thu May 13 08:16:37 EDT 2004


On 2004-05-13, Andrew Dalke <adalke at mindspring.com> wrote:
>> > Kirk Job-Sluder wrote:
>> >> Write me a two-line script in python that reads a character delimited
>> >> file, and printf pretty-prints all of the records in a different order.
>
> Carl Banks wrote one, convoluted so it can be on the command line.
> Kirk Job-Sluder replied
>> This looks like using the proverbial hammer to drive the screw.
>
> But you asked use to use the hammer to drive in the screw.  In real
> life I have more tools to use.  For this case I would use Perl or awk.

Bing, exactly the point.  

> My solution was to use the interactive Python shell.  Something
> like (untested)

Certainly, python is the best solution for many problems.

>
> Trying doing that sanely with any programming language expressed
> all on the command-line.  No credit if you can't handle the '&' and space.

Missing the point.  The point was not that everything should be done
using awk, sed or perl one-liners.  The point was that there awk, sed,
or perl one-liners are useful for a subset of tasks where the
explicitness of python gets in the way.

>
>                     Andrew
>                     dalke at dalkescientific.com
>
>



More information about the Python-list mailing list