Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

FORTH IF HONK THEN


devel / comp.lang.python / Re: How to test characters of a string

SubjectAuthor
o Re: How to test characters of a string2QdxY4RzWzUUiLuE

1
Re: How to test characters of a string

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: 2QdxY4Rz...@potatochowder.com
Newsgroups: comp.lang.python
Subject: Re: How to test characters of a string
Date: Tue, 7 Jun 2022 15:08:10 -0500
Lines: 23
Message-ID: <mailman.553.1654634061.20749.python-list@python.org>
References: <B7308648-D218-4F15-8F0E-1EC1F0A879AA@looktowindward.com>
<Yp+wKuMr2jNqVbM1@scrozzle>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de MENMvCrrQC9PO83MOz1XTANoIKvSQzlHvNq6vDtViCQQ==
Return-Path: <2QdxY4RzWzUUiLuE@potatochowder.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python?': 0.03; 'string':
0.07; 'task.': 0.07; 'describe': 0.09; 'example:': 0.09;
'language,': 0.09; 'numeric': 0.09; 'received:78': 0.09;
'subject:test': 0.09; 'steps': 0.11; '+0200,': 0.16; 'answer.':
0.16; 'from:addr:2qdxy4rzwzuuilue': 0.16;
'from:addr:potatochowder.com': 0.16; 'message-id:@scrozzle': 0.16;
'received:136.243': 0.16; 'received:www458.your-server.de': 0.16;
'received:your-server.de': 0.16; 'step.': 0.16;
'subject:characters': 0.16; 'subject:string': 0.16; 'wrote:':
0.16; 'problem': 0.16; 'python': 0.16; 'calls': 0.19; 'to:addr
:python-list': 0.20; 'subject:How': 0.23; 'received:de': 0.23;
'help.': 0.25; 'programming': 0.25; 'seem': 0.31; 'received:136':
0.32; 'but': 0.32; 'header:In-Reply-To:1': 0.34; '"the': 0.35;
'two': 0.39; 'still': 0.40; 'want': 0.40; '8bit%:43': 0.70;
'carry': 0.71; 'skip:\xe2 10': 0.71; 'life': 0.77; 'characters':
0.84; 'received:70': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <B7308648-D218-4F15-8F0E-1EC1F0A879AA@looktowindward.com>
X-Authenticated-Sender: 2QdxY4RzWzUUiLuE@potatochowder.com
X-Virus-Scanned: Clear (ClamAV 0.103.6/26565/Tue Jun 7 10:08:27 2022)
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: <Yp+wKuMr2jNqVbM1@scrozzle>
X-Mailman-Original-References: <B7308648-D218-4F15-8F0E-1EC1F0A879AA@looktowindward.com>
 by: 2QdxY4Rz...@potatochowder.com - Tue, 7 Jun 2022 20:08 UTC

On 2022-06-07 at 21:35:43 +0200,
Dave <dave@looktowindward.com> wrote:

> I’m new to Python and have a simple problem that I can’t seem to find
> the answer.

> I want to test the first two characters of a string to check if the
> are numeric (00 to 99) and if so remove the fist three chars from the
> string.

> Example: if “05 Trinket” I want “Trinket”, but “Trinket” I still want
> “Trinket”. I can’t for the life of work out how to do it in Python?

How would you do it without Python?

Given that if the string is called x, then x[y] is the y'th character
(where what you would call "the first character," Python calls "the
zeroth character"), describe the steps you would take *as a person* (or
in some other programming language, if you know one) to carry out this
task.

Translating that algorithm to Python is the next step. Perhaps
https://docs.python.org/3/library/string.html can help.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor