Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

C'est magnifique, mais ce n'est pas l'Informatique. -- Bosquet [on seeing the IBM 4341]


devel / comp.lang.python / RE: Extract lines from file, add to new files

SubjectAuthor
o RE: Extract lines from file, add to new files<avi.e.gross

1
RE: Extract lines from file, add to new files

<mailman.16.1706595177.3227.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24967&group=comp.lang.python#24967

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!uni-berlin.de!not-for-mail
From:
Newsgroups: comp.lang.python
Subject: RE: Extract lines from file, add to new files
Date: Tue, 30 Jan 2024 01:12:51 -0500
Lines: 62
Message-ID: <mailman.16.1706595177.3227.python-list@python.org>
References: <c9cf741b-9781-8dd6-96df-d270d0ac2@appl-ecosys.com>
<2a5eef2d-3d66-8cea-64eb-602ea5aff946@appl-ecosys.com>
<26039.56939.70073.816806@ixdm.fritz.box>
<e19178ea-dca9-2669-5ef2-27c58d7c69e1@appl-ecosys.com>
<9f227581-b3ee-6b8f-9791-f8f6841fbb11@appl-ecosys.com>
<4TP3Wg4yldznVG5@mail.python.org>
<013c01da5343$5b5c97c0$1215c740$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de sTS5DGmztlaq1AmBDvCf4QY61Hv4eDrCi4XBSE97aNWw==
Cancel-Lock: sha1:3gBwQ7DMS/FIZIXdYA9Y48s4r8U= sha256:uzK3vhvvEamPIKXh5wlmyUaV/SlSqg45sCfRGa5uetU=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=ClJBiCTB;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'csv': 0.03; 'fairly':
0.05; 'thread': 0.05; '(to': 0.07; 'modules': 0.07; 'subject:add':
0.07; 'attempts': 0.09; 'construct': 0.09; 'expression': 0.09;
'json': 0.09; 'module.': 0.09; 'received:108': 0.09;
'subject:files': 0.09; 'trivial': 0.09; 'url:search': 0.09;
'url:mailman': 0.15; '2024': 0.16; 'customized': 0.16; 'else?':
0.16; 'frustrated': 0.16; "hadn't": 0.16; 'locate': 0.16; 'many,':
0.16; 'missed': 0.16; 'program?': 0.16; 'programs?': 0.16;
'query.': 0.16; 'received:209.85.222.180': 0.16; 'received:mail-
qk1-f180.google.com': 0.16; 'sent,': 0.16; 'shepard': 0.16;
'sounds': 0.16; 'thread.': 0.16; 'understand.': 0.16; 'wrote:':
0.16; 'python': 0.16; 'grant': 0.17; 'instead': 0.17; 'message-
id:@gmail.com': 0.18; 'addresses': 0.19; 'to:addr:python-list':
0.20; 'subject:file': 0.22; 'way.': 0.22; 'goal': 0.23; 'lines':
0.23; 'url:wiki': 0.23; 'skip:- 10': 0.25; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'seems': 0.26;
'binary': 0.26; 'bit': 0.27; 'old': 0.27; 'done': 0.28; 'attempt':
0.31; 'seem': 0.31; 'saved': 0.31; 'url-ip:188/8': 0.31;
'question': 0.32; 'extract': 0.32; 'python-list': 0.32; 'but':
0.32; 'there': 0.33; 'someone': 0.34; 'able': 0.34; 'same': 0.34;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'trying': 0.35; 'from:addr:gmail.com': 0.35; 'files': 0.36;
'mon,': 0.36; 'change': 0.36; 'subject:from': 0.37; 'using': 0.37;
"it's": 0.37; 'received:209.85': 0.37; 'though': 0.37; 'file':
0.38; 'way': 0.38; 'could': 0.38; 'received:209': 0.39; 'two':
0.39; 'quite': 0.39; 'single': 0.39; 'text': 0.39; 'use': 0.39;
'on.': 0.39; 'received:209.85.222': 0.39; 'rest': 0.39; 'both':
0.40; 'something': 0.40; 'want': 0.40; 'should': 0.40; 'email.':
0.61; 'search': 0.61; 'method': 0.61; 'skip:o 10': 0.61; 'from:':
0.62; 'to:': 0.62; 'format': 0.62; 'subject': 0.63; 'data,': 0.63;
'email': 0.63; 'clear': 0.64; 'about.': 0.64; 're:': 0.64; 'less':
0.65; 'url:q': 0.67; 'back': 0.67; 'entire': 0.67; 'items': 0.68;
'small,': 0.69; 'within': 0.69; 'url-ip:208.80/16': 0.70;
'url:wikipedia': 0.70; 'url-ip:208/8': 0.71; 'care': 0.71;
'january': 0.71; 'deal': 0.73; 'plus': 0.73; 'easy': 0.74;
'ranging': 0.76; 'sent:': 0.78; 'database': 0.80; 'powerful':
0.84; 'figuring': 0.84; 'line,': 0.93; 'storage': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1706595173; x=1707199973; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=7KdubUadIhR1CIvUNijgGtlmhkx1S9JkaR92urXO0UQ=;
b=ClJBiCTBNGgR+hgglg5AmL20I5UnEDWxeW22zJUaO1rv2QH1AFsw+bZtyrmj3iioIL
fYYhx26ZpHKk55OV822thrivbMlWDoL8GFFDfBNdVcMQborkNdeHjMn5G7wCXryNNHRR
7tfRiu56T7XwfahziN21I9wfPhcRs06D8rnkoUY/+w2bzDHYqCw0lA6EYXGdn8RLfng/
m1M+lrLO8heRC4Yv790o+VRAspkIymB73VeFqGDSy49G63sdfQktrbQHiC1o/UbjAxbe
i/7hN4miI63FYuf9k+kMA1k5+E2UlyQzNsunfQdda6p/x0HwlTpEdsYyuBfAHiPD8ZKd
Qplg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1706595173; x=1707199973;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=7KdubUadIhR1CIvUNijgGtlmhkx1S9JkaR92urXO0UQ=;
b=tCUuCm1f3kQUpzsSUQMbPzcVMZuoBFbedVov+3fDL1LfveO2I7g/TLUZzOv4CIa6N2
guRO0b9kB1BLLC6DDvhkxQDdszt7Ad+i8vzSiYcRXHI/cR8SRlDnsIfoYjYZmDLBpKCn
lKoOIXVioSAS23mFeyE4U2m6IJr7UZJxgUsl2cind3xFXH31J/Fc0Y3KYqe9G2BV3udq
HByX6X9fXau5wJkc8alKkGcaBtrgjw+fL0GtOXnRWOCSE3a9YRrNFCQuFeSK9+C2SYSg
dYLizzU+TX1xMU84Uuo5fP0pxSSzg51KT+Gg2LAQXwelzOtECxNrq6oHK4EBJOLeyzgt
XnbQ==
X-Gm-Message-State: AOJu0YzmMCfUpf2lthYz1VAdmRRdU4DUptG6PtezytPIGQ3S3GsO9VL5
UiuvQAsxGvmyk6UvkcrELSpGYggvKu9mNAKKhQMcqhWW1HElcyVB
X-Google-Smtp-Source: AGHT+IH9tyXULF7z0hpbfPT+VlToDPP8fEE7fCt0RmUzNidsR0XrOXXG47r/zLVbtik9mkb3oIBAsg==
X-Received: by 2002:ae9:f44c:0:b0:784:8531:50ea with SMTP id
z12-20020ae9f44c000000b00784853150eamr161935qkl.2.1706595173288;
Mon, 29 Jan 2024 22:12:53 -0800 (PST)
In-Reply-To: <4TP3Wg4yldznVG5@mail.python.org>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQIT2JcvPaTF6OzWKWXSKdjDn7r16AFWmdGFAqcmBT0BrtbsGgJTNSZEAraATZKwKSLxkA==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <013c01da5343$5b5c97c0$1215c740$@gmail.com>
X-Mailman-Original-References: <c9cf741b-9781-8dd6-96df-d270d0ac2@appl-ecosys.com>
<2a5eef2d-3d66-8cea-64eb-602ea5aff946@appl-ecosys.com>
<26039.56939.70073.816806@ixdm.fritz.box>
<e19178ea-dca9-2669-5ef2-27c58d7c69e1@appl-ecosys.com>
<9f227581-b3ee-6b8f-9791-f8f6841fbb11@appl-ecosys.com>
<4TP3Wg4yldznVG5@mail.python.org>
 by: - Tue, 30 Jan 2024 06:12 UTC

It can be quite frustrating figuring out what someone wants, Grant,
especially when they just change it.

It is worse when instead of starting a new thread with an appropriate
subject line, it continues and old one that was also frustrating to
understand.

It sounds though like another attempt to do something perhaps a different
way. Both attempts seem to be to use some form of storage of a set of email
addresses plus other info like a name that can be used to make a customized
email.

Frankly, this should have been fairly easy to do without so much back and
forth. I don't care how the email is actually sent, but the rest could have
been done any number of ways such as storing the data as rows in a CSV file
or saved using JSON format and so on. It was never made clear why two files
were needed and then somehow linked and searched.

If the goal is to be able to search for something like a name and THEN find
an email address, that seems quite trivial if they are I the same file in
some format. If the number of items is small, reading it all in should not
be a big deal and you can use a regular expression or other method to locate
the entry you want and extract the additional info. If you have lots of
data, reading line after line may be less useful than just using a database
and a query.

One way to stop feeling frustrated is to stop reading the thread.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Grant Edwards via Python-list
Sent: Monday, January 29, 2024 5:54 PM
To: python-list@python.org
Subject: Re: Extract lines from file, add to new files

On 2024-01-29, Rich Shepard via Python-list <python-list@python.org> wrote:
> On Mon, 29 Jan 2024, Rich Shepard via Python-list wrote:
>
>> No, I hadn't ... but I am reading it now.
>
> Perhaps I missed the answer to my question when reading the io module. It
> explains how to open/write/read files of text and binary data, not passing
> a variable's value from one file to a place-keeper in another file.

It's not at all clear (to me) what you're asking about. When you talk
about "files" are you referring to data files? Python modules within a
single program? Seperate Python programs? Something else?

The phrase "place-keeper in another file" sounds a bit like you're
trying to do templating. There are many, many ways to do templating in
Python -- ranging from literal 'f-strings' to powerful templating
engines that are used to construct entire web sites:

https://www.google.com/search?q=python+templating

https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings

https://en.wikipedia.org/wiki/Jinja_(template_engine)

--
https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor