Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Unix weanies are as bad at this as anyone. -- Larry Wall in <199702111730.JAA28598@wall.org>


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

SubjectAuthor
o Re: Extract lines from file, add to new filesThomas Passin

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

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Extract lines from file, add to new files
Date: Mon, 29 Jan 2024 19:47:15 -0500
Lines: 35
Message-ID: <mailman.15.1706576042.3227.python-list@python.org>
References: <c9cf741b-9781-8dd6-96df-d270d0ac2@appl-ecosys.com>
<2a5eef2d-3d66-8cea-64eb-602ea5aff946@appl-ecosys.com>
<f1784a5b-662a-47fc-ada0-cc09ea2cfc24@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de NGlRN2WsWIrX1MLjwtJoaQgy8lm4sf4/u3oZORPhAEDA==
Cancel-Lock: sha1:Xai45rZkrzSMEWSVxORoXXApEj8= sha256:Ih03xCiR5cC5fZyUlnfRJmc14IEjS562kbFfH65EEMg=
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=arMsO+u7;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'file?': 0.05; 'thread':
0.05; 'variable': 0.05; '"python': 0.07; 'explanation': 0.07;
'string': 0.07; 'subject:add': 0.07; 'template': 0.07; ':-)':
0.09; 'example:': 0.09; 'question:': 0.09; 'received:23.83.212':
0.09; 'received:elm.relay.mailchannels.net': 0.09;
'subject:files': 0.09; 'tricks': 0.09; '(i.e.,': 0.16; 'assuming':
0.16; 'easiest': 0.16; 'received:10.0.0': 0.16; 'received:64.90':
0.16; 'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
'received:dreamhost.com': 0.16; 'shepard': 0.16; 'specify': 0.16;
'tia,': 0.16; 'wrote:': 0.16; 'python': 0.16; 'values': 0.17;
"aren't": 0.19; 'to:addr:python-list': 0.20; "i've": 0.22; 'skip:_
10': 0.22; 'subject:file': 0.22; 'lines': 0.23; 'header:User-
Agent:1': 0.30; 'am,': 0.31; 'looked': 0.31; 'assume': 0.32;
'extract': 0.32; 'python-list': 0.32; 'received:10.0': 0.32;
'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; "i'm": 0.33; "i'll":
0.33; 'script': 0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'system,': 0.36; 'change': 0.36; 'subject:from': 0.37; 'file':
0.38; 'changes': 0.39; 'use': 0.39; 'finding': 0.39; 'both': 0.40;
'dear': 0.62; 'email': 0.63; 'copy': 0.63; 'pass': 0.64; 'clear':
0.64; 'well': 0.65; 'worked': 0.67; 'header:Received:6': 0.67;
'received:64': 0.67; 'out.': 0.80; 'mere': 0.84; 'strings': 0.84;
'sufficiently': 0.84
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1706575636; a=rsa-sha256;
cv=none;
b=ItGHtoYjGXrP4DdYQo6o6a/fw7LEhl4wL3I+Rtbs83j693gnO9FjeVH7TBCv+FUVetZIpL
E2492ivnlP1FXrAhIIncVXQt+ROPTytRXk252aXn0/kTraQNjh9cMAo1bjDGpvR7s4VLwF
CXadgz2lyZDkVGp/9iZIoWdI4bTbt1pTt2/eOZ2DVVZnk883hga7MP3XVhlDdJbDw/HFVP
xSRbQ7DdhJ1vT92OpwldI5jLZ98uEzqC6zKLH89Y9vr7z3AcJUwCG4tYvAev3c1uFQbxN4
ZPWinPUoeMCAPKxm+R5kuFdHmCTGBnqa1vEsR9u1/2kiY5Pcdl4nGJBqLN8Hjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1706575636;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=unxlnVAta5ElDKJdiBJCpYpkVunzed2YGtFg6lZKIjk=;
b=UZ2lckTR0xl8YodW5W9gG0Lnc+D9z4GlgNeusrkxOVwcDKOUCF9qTDETUqJ0prtbrgNIA/
1j5lPcGGZo0vThfkK/kjiNS/aVZOu7YfoxZJvVMlEibt/MLk6/WVQscKaXjXsFku0mgyij
YFt0uLUHb40m2u/nKYSwfdJkOX2Cm1B/dnAYNZuWKz23XqrLsAckZCuD6jMQ+Sh7RYiObO
SGnJAXWuaDdf2k01RNrkSpjcdt78euVDC7rJy9N5hHVyT1EU8lGnz/Kr3Z5C8r0ZSl9I/a
C/m3VtPgvgJhoTnyJu6NrccHujUOj0LiaBikrJMwP0Ns2SAsO8jS6eBXfzqHIA==
ARC-Authentication-Results: i=1; rspamd-9c9494d96-jxdcp;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Fearful-Celery: 4172d48a38a00962_1706575636895_358469745
X-MC-Loop-Signature: 1706575636895:1682030922
X-MC-Ingress-Time: 1706575636894
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1706575636;
bh=unxlnVAta5ElDKJdiBJCpYpkVunzed2YGtFg6lZKIjk=;
h=Date:From:Subject:To:Content-Type:Content-Transfer-Encoding;
b=arMsO+u7wsNmINzl0FyMUPM785K2t/lQ4DNCk+1NX8S2g7FEr+jfH5mBBQIiy/Yc4
h03dGcBsQaDKHH+ig6P659ah5Rmw9/UPlcyANHzqp2EMr10HaaXmRPffBF75ALQynE
+PeQUM4HqZsYhmgo7iUTgOWfxoPYx81ZliqgEDgfjf04n6Rk4poCgg75B6y5G66c0C
rr4uHIFTEKaC9GsaLVDqpRIB+INSwYa+FMEiY5z4bxzUaeVv/5Bs2A4Y/hEfWFxMgE
cJoQI1x081kFp4t3fj1Ai5tx5rQzsAixOFZ40p9GOtbt+ypoYw34Aaj7YiYun7/++w
LERQfT6aW++HQ==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <2a5eef2d-3d66-8cea-64eb-602ea5aff946@appl-ecosys.com>
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: <f1784a5b-662a-47fc-ada0-cc09ea2cfc24@tompassin.net>
X-Mailman-Original-References: <c9cf741b-9781-8dd6-96df-d270d0ac2@appl-ecosys.com>
<2a5eef2d-3d66-8cea-64eb-602ea5aff946@appl-ecosys.com>
 by: Thomas Passin - Tue, 30 Jan 2024 00:47 UTC

On 1/29/2024 11:15 AM, Rich Shepard via Python-list wrote:
>> For my use 1) the salutation and email address (always with an '@') are
>> sequential and 2) I'm developing the script to extract both from the same
>> file.
>
> I've looked at my Python books "Python Crash Course," "Effective Python,"
> and "Python Tricks The Book" as well as web pages in my searches without
> finding the answer to what may be a simple question: how to specify a
> variable in one file that has its values in another file.
>
> Specifically, how to I designate the salutation holder in the message file
> and pass it the name value from the name/email address file?
>
> If this explanation is not sufficiently clear I'll re-write it. :-)
>
> TIA,
>
> Rich

I'm assuming this is a continuation of a previous thread about working
with alternate lines with salutation and address, and I assume you've
got that worked out.

If you aren't going to use one or another existing template system,
perhaps the easiest is to use unique strings in the message file. For
example:

Dear __##so-and-so##__:
Please don't write this message off as mere spam.
Respectfully, Rich

Then you just do a replace of the unique string by the salutation. Don't
change the original (i.e., template), make the changes to a copy that
you will output.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor