@jlmelenchon · Post #2873 · 30.06.2024 г., 12:36
A voté ! #Elections2024#ElectionsLegislatives2024 ----------- On vous a transféré ce message ? Abonnez-vous au canal Telegram de Jean-Luc Mélenchon sur : https://t.me/JLMelenchon
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #22 · 19 јан.
Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: names = [ 'image.bmp', 'second.txt.bkp', 'data.db', '.config.cfg', 'file.ext.bkp' ] И мы хотим убрать у них окончание ".bkp". Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное. Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip(). Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк). В нашем случае будет выглядеть вот так: >>> name.strip('.bkp') То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть. Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный. >>> for name in names: >>> print(name.strip('.bkp')) image.bm second.txt data.d config.cfg file.ext Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp' А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке. Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'. Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку. >>> for name in names: >>> print(name.replace('.bkp', '')) image.bmp second.txt data.db .config.cfg file.ext Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем. Просто впредь будьте внимательны с этим strip(). #basic
Hashtags
Пребарај: #elections2024
@jlmelenchon · Post #2873 · 30.06.2024 г., 12:36
A voté ! #Elections2024#ElectionsLegislatives2024 ----------- On vous a transféré ce message ? Abonnez-vous au canal Telegram de Jean-Luc Mélenchon sur : https://t.me/JLMelenchon
@venanalysis · Post #1745 · 15.09.2024 г., 23:07
The Venezuelanalysis podcast returns! After a short hiatus, we're back with a new format! VA staff is set to feature more prominently and we'll publish on video as well. In this episode, host José Luis Granados Ceja and editor Ricardo Vaz break down the electoral aftermath in Venezuela. Follow this link for early access: https://www.patreon.com/posts/112126008 #Venezuela#Podcast#Elections2024
Hashtags
@venanalysis · Post #1658 · 21.07.2024 г., 18:09
With one week to go, VA columnist Jessica Dos Santos tackles the ongoing electoral campaign and the different scenarios ahead of the presidential vote in Venezuela. Read the article: https://venezuelanalysis.com/columns/the-same-old-path-and-the-dangerous-one/ #Venezuela#Elections2024#Democracy
@venanalysis · Post #1627 · 01.07.2024 г., 15:45
Venezuelanalysis columnist Clodovaldo Hernández offers a deep dive into the complexities and uncertainties surrounding Venezuela's July 28 presidential elections. He tackles Maduro's prospects and challenges, as well as those of the US-backed opposition. Read the column: https://venezuelanalysis.com/analysis/july-28-an-equation-with-multiple-unknowns/ #Venezuela#Elections2024#Democracy
@venanalysis · Post #1720 · 15.08.2024 г., 23:39
The four-person UN panel said that the lack of detailed results had a “negative impact on confidence in the [electoral] outcome” announced by the CNE. The electoral body accused the UN team of violating its agreement and carrying forward a "political agenda." Read the report: https://venezuelanalysis.com/news/venezuela-electoral-authorities-reject-un-experts-report-for-political-agenda/ #Venezuela#Elections2024#UnitedNations
@venanalysis · Post #1703 · 31.07.2024 г., 03:18
The Venezuelanalysis team held a livestream on Tuesday evening to provide an on-the-ground update of the situation in Venezuela following Sunday's elections. Watch the video: https://venezuelanalysis.com/video/venezuelas-post-election-scene-on-the-ground-reports/ #Venezuela#Chavismo#Elections2024
@venanalysis · Post #1708 · 04.08.2024 г., 15:14
TeleSUR journalist Brian Mier offers a chronicle of Venezuela's July 28 presidential vote in one of Caracas' largest polling centers. Read the report: https://venezuelanalysis.com/opinion/electoral-theater-in-venezuela-a-tale-from-election-day-in-caracas/ #Venezuela#Elections2024#Violence
@venanalysis · Post #1710 · 06.08.2024 г., 03:38
Chavista analyst and activist Luigino Bracci talked to computing expert Victor Theoktisto to address open questions surrounding the July 28 elections. “The opposition must challenge the results before the TSJ, not in public opinion or international media,” stated the professor. Read the article: https://venezuelanalysis.com/analysis/cybersecurity-expert-on-fraud-claims-and-voting-safeguards-in-venezuelas-presidential-election/ #Venezuela#Elections2024#cybersecurity
@venanalysis · Post #1709 · 04.08.2024 г., 23:46
Venezuelan President Nicolás Maduro said authorities had neutralized a “fascist outbreak” following last Sunday's elections. Check out a gallery of yesterday's rallies: https://venezuelanalysis.com/images/venezuela-government-opposition-supporters-take-to-the-streets-in-post-electoral-scene/ #Venezuela#Elections2024#Demonstration
@venanalysis · Post #1707 · 03.08.2024 г., 13:35
Chavismo and the US-backed opposition are mobilizing this Saturday after updated electoral results continue favoring President Maduro. Meanwhile, the Venezuelan Supreme Court demanded that candidates and the electoral body submit evidence in order to review the vote results. Read the full story: https://venezuelanalysis.com/news/venezuela-cne-ratifies-maduro-victory-supreme-court-demands-voting-records-and-hacking-evidence/ #Venezuela#SupremeCourt#Elections2024
@venanalysis · Post #1633 · 06.07.2024 г., 18:37
Incumbent Nicolás Maduro and opposition challenger Edmundo González saw supporters come out en masse in Caracas as the campaign officially began ahead of the July 28 presidential vote. There are 10 candidates running. Both Maduro and González have expressed confidence in victory. Report + photos: https://venezuelanalysis.com/images/venezuela-presidential-campaign-kicks-off-with-massive-rallies/ #Venezuela#Elections2024#CampaignTrail
@embajadarusaven · Post #1452 · 15.03.2024 г., 16:24
⚡️Arrancan las #elecciones presidenciales en #Rusia Por primera vez se celebran durante tres días de acuerdo con las peticiones de los ciudadanos, según informó anteriormente Ella Pamfilova, presidenta de la Comisión Electoral Central (CEC). En las actuales elecciones presidenciales se utilizará activamente el voto electrónico a distancia: según la CEC, unos 5 millones de ciudadanos rusos van a votar por Internet, por lo que se ha prestado especial atención a la ciberseguridad. ✔️ Por primera vez, los residentes de nuevas regiones del país votarán en las elecciones presidenciales. ⚡️Las primeras estadísticas estarán disponibles a partir del 17 de marzo. #Elections2024#VoteForRussia