BIOSUtilities/common/num_ops.py
platomav 132457afda Initial refactor commit
Added AMI UCP BIOS Extractor v2.0_a1

Added AMI BIOS Guard Extractor v4.0_a1
2022-04-01 17:43:22 +03:00

11 lines
No EOL
282 B
Python

#!/usr/bin/env python3
#coding=utf-8
# https://leancrew.com/all-this/2020/06/ordinals-in-python/ by Dr. Drang
def get_ordinal(number):
s = ('th', 'st', 'nd', 'rd') + ('th',) * 10
v = number % 100
return f'{number}{s[v % 10]}' if v > 13 else f'{number}{s[v]}'