mirror of
https://github.com/Redume/Shirino.git
synced 2024-12-04 22:16:21 +03:00
15 lines
426 B
Python
15 lines
426 B
Python
|
def format_number(number):
|
||
|
number_str = str(number)
|
||
|
|
||
|
if '.' in number_str:
|
||
|
integer_part, fractional_part = number_str.split('.')
|
||
|
else:
|
||
|
integer_part, fractional_part = number_str, ''
|
||
|
|
||
|
formatted_integer_part = '{:,}'.format(int(integer_part)).replace(',', ' ')
|
||
|
|
||
|
if fractional_part:
|
||
|
return formatted_integer_part + '.' + fractional_part
|
||
|
else:
|
||
|
return formatted_integer_part
|