Encapsulation, inheritance and polymorphism

Lipska the Kat lipska at lipskathekat.com
Tue Jul 17 14:21:43 EDT 2012


On 17/07/12 18:24, Terry Reedy wrote:
> On 7/17/2012 8:01 AM, Lipska the Kat wrote:
>> On 17/07/12 09:45, Lipska the Kat wrote:
>>> Pythoners
>>>>>> Python 2.7.3
>>> Ubuntu Linux 12.04 LTS
>>>>>> I've been taking a brief look at Python.
>>>>>>> snip
> >>
>> Well I've set myself a task.
>> I have a text file containing a list of stock items
>> each line contains the number in stock followed by a tab followed by the
>> name of the item. I need to implement something that reads in the text
>> file and outputs the stock list in ascending or descending order of
>> quantity.

snip
>>> In bash this is laughably trivial
>>>> sort -nr 1ドル | head -${2:-10}
>> Won't sort work alphabetically and leave the following as is?
>> 1\talpha
> 11\tbeta
> 2\tgamma

The -n option tells sort to interpret the first word on a line as a 
number r means sort in descending order. It works fine. I also added 
another feature not in the specification that allows the input of a 
number of lines to print ...
well on the way to being bloatware I guess ;-)
Lipska
-- 
Lipska the Kat: Troll hunter, Sandbox destroyer
and Farscape dreamer of Aeryn Sun.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /