TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #83 · 11 мај

У строки в Python есть два очень похожих метода. На столько похожих что кажется они делают одно и тоже. Это метод isdigit() и isnumeric() Давайте посмотрим зачем нам два одинаковых метода? И так ли они одинаковы? Очевидно что isdigit() говорит нам, состоит ли строка только из чисел 0-9 >>> '12'.isdigit() True >>> '12x'.isdigit() False >>> '-12'.isdigit() False >>> '12.5'.isdigit() False Можно предположить что isnumeric() делает более глубокий анализ и распознаёт в строке float или отрицательное число. >>> '15'.isnumeric() True >>> '-15'.isnumeric() False >>> '15.2'.isnumeric() False Нет, всё так же как и с другим методом. В чем же тогда разница? Для начала посмотрим следующие примеры: >>> '5'.isdigit(), '5'.isnumeric() # Обычная цифра 5 # True, True >>> '꧕'.isdigit(), '꧕'.isnumeric() # Яванская 5 # True, True >>> '෩'.isdigit(), '෩'.isnumeric() # Синхала 3 # True, True >>> '৩'.isdigit(), '৩'.isnumeric() # Бенгальская 3 # True, True >>> '༣'.isdigit(), '༣'.isnumeric() # Тибетская 3 # True, True >>> '³'.isdigit(), '³'.isnumeric() # 3 верхний индекс (степень) # True, True >>> '𝟝'.isdigit(), '𝟝'.isnumeric() # Математическая двойная 5 # True, True >>> '๔'.isdigit(), '๔'.isnumeric() # Тайская 4 # True, True >>> '➑'.isdigit(), '➑'.isnumeric() # 8 в круге # True, True А теперь примеры в которых, по мнению Python, результаты не равны >>> '¾'.isdigit(), '¾'.isnumeric() # дробь три четверти # False, True >>> '⅕'.isdigit(), '⅕'.isnumeric() # дробь одна пятая # False, True >>> '𒐶'.isdigit(), '𒐶'.isnumeric() # клинопись 3 # False, True >>> '三'.isdigit(), '三'.isnumeric() # 3 из унифицированной идеограммы # False, True >>> '⑩'.isdigit(), '⑩'.isnumeric() # цифра 10 в круге # False, True >>> 'Ⅳ'.isdigit(), 'Ⅳ'.isnumeric() # Римская 4 # False, True >>> '𑇪'.isdigit(), '𑇪'.isnumeric() # Сенегальская архаическая 10 # False, True >>> '𐌢'.isdigit(), '𐌢'.isnumeric() # Этрусская цифра 10 # False, True >>> 'ↂ'.isdigit(), 'ↂ'.isnumeric() # Римская цифра 10000 # False, True >>> '〇'.isdigit(), '〇'.isnumeric() # Символ ККЯ ноль # False, True Получается, что isdigit() говорит нам, является ли символ десятичной цифрой или спецсимволом, имеющим цифирное значение после преобразования. В свою очередь isnumeric() включает все дополнительные символы юникода которые имеют отношения к числовым и цифровым представлениям. Ну и пара примеров в которых в обоих случаях символ не является числом, это эмодзи. >>> '🕙'.isdigit(), '🕙'.isnumeric() # эмодзи 10 часов # False, False >>> '7️⃣'.isdigit(), '7️⃣'.isnumeric() # эмодзи 7 # False, False Также есть еще один дополнительный и весьма полезный метод isdecimal(). Он нам сообщает, можно ли из указанного символа сделать простую десятичную цифру. То есть сработает ли метод int(x) >>> '෩'.isdecimal(), int('෩') # Синхала 3 # True, 3 >>> '➑'.isdecimal(), int('➑') # 8 в круге # False, ValueError Какие выводы? 🔸 При определении цифры в строке isdigit() подходит лучше чем isnumeric(), но оба не гарантируют успешную конвертацию в int 🔸 Для однозначного определения возможности преобразования строки в int лучше подходит метод isdecimal() 🔸 Для однозначного определения символов 0...9 лучше использовать regex Полный список символов юникода которые определяются как numeric #basic

Hashtags

Резултати

Пронајдени 95 слични објави

Пребарај: #fashionweek

当前筛选 #fashionweek清除筛选
In Voga | Fashion & Web 3.0

@invogafashion · Post #3199 · 30.09.2022 г., 10:16

Acne Studios Spring 2023 on how to wear: - lace with spikes - chiffon with rough leather - torn jersey with flounces - chapped skin with floral choker - jeans to the neckline (for those who missed the high waist 😂) -bows instead of a bodice - denim vest with sheer skirts And use the bag as a means of self-defense 😉 #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #3189 · 28.09.2022 г., 12:03

And I have for you a new batch of fresh street shot by myself before the Elisabetta Franchi Spring 2023 show. Minis, catsuits, heels, over the knee boots, hats, maxi flowers, slits and sexy in the truest sense of the Italians. #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #3169 · 22.09.2022 г., 10:50

Fendi delighted everyone who bought green clothes last year and continued this grassy extravaganza in the Spring 2023 collection. Handbags, slippers, boots, and even total-green 💚 Delicate pistachio and fresh mint were a plus to the herbal one. Honestly, it reminds me a little of the best times at Bottega. There are fluffy mules, a lot of knitwear, elongated sleeves, and shaggy textures. And from the special, I liked the delicate asymmetry and side slits on the sleeves and skirts. #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #3137 · 13.09.2022 г., 11:03

Heading to NY for fashion week? 😉 Beautiful Carolina Herrera Spring 2023 with its already signature stripe 🖤 paired with a millefleur. Large textile flowers were added to the tiny floral print, gorgeous flowered textile boots and sandals, clear reception of accent printed accessories - a clutch or a belt, a mix of flowers of different colors. And, according to tradition, many flying fabrics, ruffles, voluminous sleeves - in general, everything we expect from the spring collection. #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2988 · 19.07.2022 г., 15:12

Rings on the toes, of course, are not new and, frankly, not the most convenient accessory, but they convey the atmosphere of summer and relaxation perfectly. At Etro Spring 2023 Menswear, rings were used with pajama sets, linen shorts and trousers, classic blue denim, and even a summery white suit. Although the show was for men, the idea is agender, so let's try! #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2793 · 04.06.2022 г., 10:32

The first eco-activist among brands is Stella McCartney, in her case, these are not empty words. Grape cake, eco-leather from the root structure of mushrooms, and many more eco-materials are in the Resort 2023 collection. Particular attention (as always) in the collection is paid to: - prints (mushrooms🍄, stripes, animals🐯🐄🦜 and animalistic) - textures, the variety of which is great - shapes (slits, fringes, the effect of ruggedness and perforation, the latter are generally given the central place of this collection, and the perforations are not on leather but cotton). The lookbook was filmed on an Italian farm❤️ #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2625 · 12.05.2022 г., 12:03

The Fendace collaboration went on sale today. If you look at the details separately, I like it: a cap with the Fendi logo, pins on the dress, the idea of a branded lining is not new, but it also looks good - in general, it’s not bad separately, but all together - for an amateur🙈 The video fully conveys the nature of the collection 😉 #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2362 · 30.03.2022 г., 12:01

In addition, to cringe sausages/balloons, car dresses, lip stories, the Loewe Fall 2022 show also featured leather dresses frozen in motion, made in the same technique as the already legendary Zendaya dress. Sits like a glove 👌🏼 - literally and figuratively. #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2301 · 23.03.2022 г., 12:32

A "talking" screensaver at Alexander McQueen Fall 2022 show, piles of mulch, peat smell, birds chirping, and insect sounds awaited guests before being shown the collection at a warehouse in Brooklyn, New York. And the main theme of the collection is mycelium. In the center of the collection there is bright mushroom embroidery and silk fringe, protruding knitted threads, which just imitated mycelium. But there were also less conceptual and more brand-specific rough leather, taffeta, blurry prints, X-shaped silhouettes. #fashionweek

Hashtags

In Voga | Fashion & Web 3.0

@invogafashion · Post #2271 · 16.03.2022 г., 14:07

I reviewed the Jil Sander Fall 2022 collection. Based on the experience of past years I am sure that it will be taken apart for details, what you should pay attention to: - capes, dresses, and cape blouses - the royal vibe continues its procession - very minimalist bows - infantilism made its way even here - lots of vest coats are my special love which is perfect for styling - long gloves - they have been talked about many times, just another reminder - caps on the head - a headdress that conquers our heads in the literal and figurative sense - "knitted" fur - another eco-friendly solution after the mass rejection of natural fur - Chelsea with metal trim - the harsh realities of the modern world - large collars are a signature detail of the brand, which is only getting bigger. #fashionweek

Hashtags

123•••78
ПретходнаСтраница 1 од 8Следна