Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37477

Re: Any algorithm to preserve whitespaces?

References <CAE7MaQZyvwOvD6ggMDZ4+b=r1PsKuYX+VZThEpKvxBbfJJCK3g@mail.gmail.com> <50FAEE23.5030107@lightbird.net> <CAE7MaQb2-qQXuAJ4jK6RB+fOPO0ZjK6_gEuigqP_FOn0=Sv29g@mail.gmail.com> <50FFBCC5.5020506@davea.name>
Date 2013-01-23 20:26 +0530
Subject Re: Any algorithm to preserve whitespaces?
From Santosh Kumar <sntshkmr60@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.900.1358953018.2939.python-list@python.org> (permalink)

Show all headers | View raw


Yes, Peter got it right.

Now, how can I replace:

    script, givenfile = argv

with something better that takes argv[1] as input file as well as
reads input from stdin.

By input from stdin, I mean that currently when I do `cat foo.txt |
capitalizr` it throws a ValueError error:

    Traceback (most recent call last):
      File "/home/santosh/bin/capitalizr", line 16, in <module>
        script, givenfile = argv
    ValueError: need more than 1 value to unpack

I want both input methods.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Any algorithm to preserve whitespaces? Santosh Kumar <sntshkmr60@gmail.com> - 2013-01-23 20:26 +0530
  Re: Any algorithm to preserve whitespaces? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-24 11:49 +1100
    Re: Any algorithm to preserve whitespaces? Dave Angel <d@davea.name> - 2013-01-23 21:05 -0500

csiph-web