Long Live Python!

Quinn Dunkan quinn at yak.ugcs.caltech.edu
Wed Jul 11 18:22:16 EDT 2001


On Wed, 11 Jul 2001 20:34:17 GMT, Rainy <sill at optonline.net> wrote:
>On Wed, 11 Jul 2001 12:10:43 -0600 (MDT), Bruce Sass <bsass at freenet.edmonton.ab.ca> wrote:
>> On Wed, 11 Jul 2001, phil hunt wrote:
>>> On Tue, 10 Jul 2001 15:31:11 -0700, Paul Prescod <paulp at ActiveState.com> wrote:
>> <...>
>>> >Python does not have a niche and is not obviously a niche-friendly
>>> >language.
>>>
>>> Sure it does: python's niche is as a scripting language that's also good
>>> for longer programs.
>> 
>> Hehe, you must have missed the recent thread about removing the first
>> line from a text file... I thought it showed that Python is a horrible
>> scripting language, way too verbose, it turned what should be a few
>> lines of script into a program.
>
>Wasn't one solution only 2 lines? If I remember right it was Alex
>Martelli's.

open(output, 'w').writelines(open(input).readlines()[1:])

... can I go back to using python a scripting language now?

Here's a superior solution:

import sys
sys.stdout.writelines(sys.stdin.readlines()[1:])

A mere semicolon could turn this two line program monstrosity back into a
beautifully script-like one line.



More information about the Python-list mailing list