Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17623
| From | Nick Dokos <nicholas.dokos@hp.com> |
|---|---|
| Subject | Re: Text Processing |
| References | <209c2abf-dd56-4a7f-839b-fad92920d457@m7g2000vbc.googlegroups.com> <20111220210321.77451e19@bouzin.lan> |
| Organization | HPCS |
| Date | 2011-12-20 16:04 -0500 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3885.1324418997.27778.python-list@python.org> (permalink) |
Jérôme <jerome@jolimont.fr> wrote:
> Tue, 20 Dec 2011 11:17:15 -0800 (PST)
> Yigit Turgut a écrit:
>
> > Hi all,
> >
> > I have a text file containing such data ;
> >
> > A B C
> > -------------------------------------------------------
> > -2.0100e-01 8.000e-02 8.000e-05
> > -2.0000e-01 0.000e+00 4.800e-04
> > -1.9900e-01 4.000e-02 1.600e-04
> >
> > But I only need Section B, and I need to change the notation to ;
> >
> > 8.000e-02 = 0.08
> > 0.000e+00 = 0.00
> > 4.000e-02 = 0.04
> >
> > Text file is approximately 10MB in size. I looked around to see if
> > there is a quick and dirty workaround but there are lots of modules,
> > lots of options.. I am confused.
> >
> > Which module is most suitable for this task ?
>
> You could try to do it yourself.
>
Does it have to be python? If not, I'd go with something similar to
sed 1,2d foo.data | awk '{printf("%.2f\n", $2);}'
Nick
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Text Processing Yigit Turgut <y.turgut@gmail.com> - 2011-12-20 11:17 -0800
Re: Text Processing Dave Angel <d@davea.name> - 2011-12-20 14:57 -0500
Re: Text Processing Jérôme <jerome@jolimont.fr> - 2011-12-20 21:03 +0100
Re: Text Processing Nick Dokos <nicholas.dokos@hp.com> - 2011-12-20 16:04 -0500
Re: Text Processing Alexander Kapps <alex.kapps@web.de> - 2011-12-21 01:01 +0100
Re: Text Processing Yigit Turgut <y.turgut@gmail.com> - 2011-12-22 03:11 -0800
csiph-web