The Very "Useful" abs() Function  #coding #python #programming

The Very "Useful" abs() Function #coding #python #programming

KrishDotPy

11 дней назад

2,286 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@rndargis0
@rndargis0 - 29.05.2025 03:07

This can be used to prevent a bug where you are inputing UTF-8 encoding and saving it as ASCII.

Following your example : the charater "é" in ASCII is the value 0xe9 in hexadecimal. However in UTF-8 the value is encoded in two bytes as 0xc3 0xa9.

This is not a problem for most situation , however if you work with some legacy code or some industrial equipement, sometimes they can only read the data in ASCII. The two bytes for "é" would be transfered into the value "0©" (edit: actually there is the bug lol it supposed to be 0 followed by the copyright symbol in ascii). It is a niche usecase , but can help for patching/debugging.

Other than that usecase I do agree it's useless and I didn't even knew it existed. Good job !

Ответить

Máy Gỗ Đại Phúc Vinh Review Showroom Bình Dương Có Những Máy Móc Gì ? MÁY CHẾ BIẾN GỖ - ĐẠI PHÚC VINH CNC HỒ CHÍ MINH
ЦГБ им. М.Горького. Стихотворение-посвящение читает А.Невидомый Центральная городская библиотека им. М. Горького (ЦБС г. Макеевки)