How to test characters of a string

De ongekruisigde ongekruisigde at news.eternal-september.org
Wed Jun 8 05:06:22 EDT 2022


On 2022-06-08, Christian Gollwitzer <auriocus at gmx.de> wrote:
> Am 07.06.22 um 23:01 schrieb Christian Gollwitzer:
>
>>> In [3]: re.sub(r'^\d+\s*', '', s) Out[3]: 'Trinket'
>>>
>
> that RE does match what you intended to do, but not exactly what you 
> wrote in the OP. that would be '^\d\d.'  start with exactly two digits 
> followed by any character.

Indeed but then I'd like '\d{2}' even better.


> 	Christian


-- 
<StevenK> You're rewriting parts of Quake in *Python*?
<knghtbrd> MUAHAHAHA


More information about the Python-list mailing list