Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49653
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joshua.landau.ws@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'subject:file': 0.07; 'line:': 0.09; 'literal': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'otherwise:': 0.16; 'subject:Text': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'follows': 0.31; 'received:google.com': 0.35; 'really': 0.36; 'skip:o 20': 0.38; 'how': 0.40; 'skip:u 10': 0.60; 'july': 0.63; 'more': 0.64; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ErKZnJLELSQHcmstQ6abHC9BDXdqvi64pJU23zfqWCM=; b=N9nEp5D0iJbspkXeDU8QDJUEPaXH9GzTnxiIQBtLs/MVnHIxQQM6HoGDx4zzQCERWB VpSpZbUS7Jmc3V0Qx8uQXvFZnY3aZNvIh8IwFicCxRryYUlrM2DgXonMsKIncFI4HMgd 4LuOeqzJZQHwjp7lCdB4DqoMwTajyVZP85unQ083i3gZWZlJuYYQqR2ZZsPjo3Dll5+v BqPQw7/gm17UOVm0qCz6VFGa3dBcL9lqvQxuOKj0VzZyTFRu+NjfPWoy8jeWlH6Nip4c uSG+iQxzTpSZKLLLeyUyMSLjhs9uVx3jTAUp3b6y7LivvXWbZpt0k46b94NkVG3Q3/K6 FlkA== |
| X-Received | by 10.152.42.171 with SMTP id p11mr9194080lal.79.1372796946507; Tue, 02 Jul 2013 13:29:06 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <I9GAt.794$ct1.646@newsfe07.iad> |
| References | <08ae2828-1532-47b6-a9cb-208549189467@googlegroups.com> <b3gnnaFbe60U1@mid.individual.net> <8ea32ea7-2cee-4e61-8cbd-066721d88d4a@googlegroups.com> <I9GAt.794$ct1.646@newsfe07.iad> |
| From | Joshua Landau <joshua.landau.ws@gmail.com> |
| Date | Tue, 2 Jul 2013 21:28:26 +0100 |
| Subject | Re: Parsing Text file |
| To | Tobiah <toby@tobiah.org> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list <python-list@python.org> |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4123.1372796949.3114.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1372796949 news.xs4all.nl 15984 [2001:888:2000:d::a6]:48865 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:49653 |
Show key headers only | View raw
On 2 July 2013 20:50, Tobiah <toby@tobiah.org> wrote:
> How do we know whether we have Sometext?
> If it's really just a literal 'Sometext', then
> just print that when you hit maskit.
>
> Otherwise:
>
>
> for line in open('file.txt').readlines():
>
> if is_sometext(line):
> memory = line
>
> if line == 'maskit':
> print memory
My understanding of the question follows more like:
# Python 3, UNTESTED
memory = []
for line in open('file.txt').readlines():
if line == 'maskit':
print(*memory, sep="")
elif line:
memory.append(line)
else:
memory = []
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Parsing Text file sas429s@gmail.com - 2013-07-02 11:45 -0700
Re: Parsing Text file Neil Cerutti <neilc@norwich.edu> - 2013-07-02 19:24 +0000
Re: Parsing Text file sas429s@gmail.com - 2013-07-02 12:30 -0700
Re: Parsing Text file Tobiah <toby@tobiah.org> - 2013-07-02 12:50 -0700
Re: Parsing Text file Neil Cerutti <neilc@norwich.edu> - 2013-07-02 20:12 +0000
Re: Parsing Text file sas429s@gmail.com - 2013-07-02 13:28 -0700
Re: Parsing Text file Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 21:56 +0100
Re: Parsing Text file Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-03 00:55 +0000
Re: Parsing Text file Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 21:28 +0100
csiph-web