Comparing text strings

Peter Pearson pkpearson at nowhere.invalid
Sun Apr 18 11:41:46 EDT 2021


On Sun, 18 Apr 2021 06:38:16 GMT, Gilmeh Serda wrote:
> On Mon, 12 Apr 2021 16:11:21 -0700, Rich Shepard wrote:
>
>> All suggestions welcome.
>
> Assuming you want to know which is the oldest version and that the same 
> scheme is used all the time, could this work?
>
>>>> s1='atftp-0.7.2-x86_64-2_SBo.tgz'
>>>> s2='atftp-0.7.4-x86_64-1_SBo.tgz'
>>>> s1>s2
> False
>>>> s2>s1
> True
[snip]

However, beware:

>>> s2='atftp-0.7.4-x86_64-1_SBo.tgz'
>>> s3='atftp-0.7.10-x86_64-1_SBo.tgz'
>>> s2>s3
True

-- 
To email me, substitute nowhere->runbox, invalid->com.


More information about the Python-list mailing list