"Ну и как же нам перекидывать строки ви числа?" спросите вы. Проверять каждый символ, очистив строку от лишних знаков и точек. Потом конвертить допустимые символы в числа и восстанавливать знак, дробную чусть и тд???
Самый быстрый способ это просто "попробовать" 😜
text = "-0.3"
try:
num = float(text)
except ValueError:
print('Dough!')
Всё остальное это уже парсинг и разбор символов для иных целей.
#basic
🌍 In Shenzhen, China, nearly all public buses and taxis run on electricity, making it the world’s first major city to fully switch its urban transit fleet to electric vehicles. ✨
#urbangeography⚡#transport⚡#innovation⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 Melbourne, Australia, is regularly ranked as one of the world’s most liveable cities thanks to its blend of extensive parks, creative laneways, and a tram network that covers over 250 kilometers. ✨
#urbangeography⚡#citylife⚡#infrastructure⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The world’s tallest residential building, Central Park Tower in New York City, rises 472 meters. Ultratall skyscrapers like this change city skylines and challenge how we design urban living spaces. ✨
#urbangeography⚡#skyscraper⚡#citylife⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In Seoul, over half the city’s rooftops host gardens, solar panels, or small farms—turning unused urban spaces into green zones that cool neighborhoods and boost local food production. ✨
#urbangeography⚡#cityplanning⚡#greencities⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels