Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81973
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gary.herron@islandtraining.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.016 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:text': 0.05; 'subject:file': 0.07; 'subject:help': 0.08; 'level:': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'python': 0.11; 'expressions.': 0.16; 'url:re': 0.16; 'wrote:': 0.18; '(where': 0.19; 'thanks.': 0.20; 'header:User-Agent:1': 0.23; 'received:emailsrvr.com': 0.24; 'received:(smtp server)': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'extract': 0.31; 'gary': 0.31; 'file': 0.32; 'regular': 0.32; 'text': 0.33; 'url:python': 0.33; 'subject:with': 0.35; 'done,': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'level': 0.37; 'represent': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'url:3': 0.61; 'charset:windows-1252': 0.65; 'sample': 0.67; 'on...': 0.68; 'useful.': 0.68; 'score': 0.74; 'irrelevant': 0.84; 'round,': 0.91 |
| X-Virus-Scanned | OK |
| X-Sender-Id | gary.herron@islandtraining.com |
| Date | Thu, 04 Dec 2014 20:54:15 -0800 |
| From | Gary Herron <gary.herron@islandtraining.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: help with processing text file |
| References | <d3e302d4-f4de-4307-8c72-60ed643b264d@googlegroups.com> |
| In-Reply-To | <d3e302d4-f4de-4307-8c72-60ed643b264d@googlegroups.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16605.1417755628.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417755628 news.xs4all.nl 2852 [2001:888:2000:d::a6]:57294 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 3485 |
| X-Received-Body-CRC | 3406521591 |
| Xref | csiph.com comp.lang.python:81973 |
Show key headers only | View raw
On 12/04/2014 08:46 PM, C. Ng wrote: > Hi, > > Given the sample text file below (where the gibberish represent the irrelevant portions) : > > .... > abcddsdfffgfg > ggfhghghgfhghgh round 5 xccdcxcfd > sdfdffdfbcvcvbbvnghg score = 0.4533 > abcddsdfffgfg round 5 level = 0.15 > ggfhghghgfhghgh round 10 dfsdfdcdsd > sdfdffdfbcvcvbbvnghg score = 0.4213 > sdsdaawddddsds round 10 level = 0.13 > ......and so on.... > > > I would like to extract the values for round, score and level: > 5 0.4533 0.15 > 10 0.4213 0.13 > ....and so on... > > Please advise me how it can be done, and what Python functions are useful. > > Thanks. I would use regular expressions. See https://docs.python.org/3/library/re.html Gary Herron
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
help with processing text file "C. Ng" <ngcbmy@gmail.com> - 2014-12-04 20:46 -0800 Re: help with processing text file Gary Herron <gary.herron@islandtraining.com> - 2014-12-04 20:54 -0800 Re: help with processing text file Dave Angel <davea@davea.name> - 2014-12-05 00:46 -0500
csiph-web