Regular expression

Johann Spies johann.spies at gmail.com
Wed Jul 26 08:00:01 EDT 2017


On 26 July 2017 at 13:52, Kunal Jamdade <kunal123jamdade at gmail.com> wrote:
> There is a filename say:- 'first-324-True-rms-kjhg-Meterc639.html' .
>
> I want to extract the last 4 characters. I tried different regex. but i am
> not getting it right.
>
> Can anyone suggest me how should i proceed.?

What have you tried?

Why do you need regular expression?

>>> s = 'first-324-True-rms-kjhg-Meterc639.html'

>>> s[-4:]
'html'

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)



More information about the Python-list mailing list