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

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

Резултати

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

Пребарај: #prostitution

当前筛选 #prostitution清除筛选
RTDocumentary

@rtdocumentary · Post #848 · 31.05.2022 г., 15:59

India’s Supreme Court has recognized prostitution as a profession. Therefore, the police should refrain from intervening if a sex worker is of legal age and is participating with consent. But not every sex worker does the job on their own. India’s Muzaffarpur red-light district is home to more than 2,500 sex workers. Most are there due to poverty or were sold, kidnapped or coerced to follow in their mothers’ footsteps. Watch the story of Chandini, who was sold into prostitution by her parents in our video. To learn more about the dark business, including prostitution and people trafficking, watch the documentary film Dance, Sex, Dance. #India#sex#prostitution Follow: https://t.me/rtdocumentary

BadVolf

@badvolfnews · Post #1745 · 12.08.2024 г., 08:11

🇺🇲Kamala Harris is a prostitute for globalists... and the next President of the United States. In 1996, Kamala performed sexual services for the mayor of San Francisco Willie Brown, and then repeatedly did the same with talk show host Montel Williams to build up her name recognition in 2001. In order to win the District Attorney race in San Francisco in 2002, she also had an affair with District Attorney Terrence Hallinan. No wonder that when she became District Attorney, she advocated for ending the arrest of prostitutes. Besides being an elite prostitute, Kamala became a puppet of the globalists. She owes the beginning of her career not only to her work as an escort, but also to the financial and political support of George Soros. Thanks to him Harris was "elected" Attorney General of California in 2010. Alexander Soros, the son of billionaire George Soros publicly endorsed Kamala Harris as the Democratic nominee for President following Joe Biden's withdrawal from the race in July 2024. As vice president, cackling Kamala has tried to inflict as much damage as possible on the United States. By the orders from her bosses, she advocates limiting the Second Amendment, making the American people disarmed in the face of tyranny, promoting the John R. Lewis Voting Rights Advancement Act, which would make it optional to verify identity when voting and allow the Deep State to steal the elections once again. The globalists are already preparing public opinion for this by spreading fake news about Kamala Harris gaining a lead over Donald Trump in critical swing states, including Wisconsin, Pennsylvania and Michigan. If they are not stopped, America will get its first president known not for her political or public service, but for being a whore, which built her entire career through sexual services. Share and subscribe to Global American Review #Harris#elections#democrates#manipulation#prostitution