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

Резултати

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

Пребарај: #intermediate

当前筛选 #intermediate清除筛选
English Speakers

@English_Speakers · Post #4542 · 06.05.2021 г., 00:42

#intermediate 📌 made my day Meaning 👉 To cause one to feel very happy; to be a very positive highlight of one's day. Example When my neighbors surprised me with homemade chocolate chip cookies, it is really made my day. @English_Speakers

English Speakers

@English_Speakers · Post #4479 · 17.03.2021 г., 17:59

#Intermediate @English_Speakers 📌 When the cat a way the mice will play غاب القط فالعب يا فار people being supervised often do things they are not supposed to do when the supervising person is not around (expression often used in a humorous way about employer and employees, parents and children, etc.) 👉Example: "“His parents are away for the weekend.” “I see—while the cat's away.” @English_Speakers

New Psychedelics compounds search. Why? Deal with First gen psychedelic issues: - they were not created specifically to threat a particular disorder even if can do it with a certain efficacy - they have cardiotoxicity related to 5ht2b mechanism - long action duration length for therapy New hopes and ideas: - decouple halucenogetic from therapeutic effect - potentially reaching even newer states of mind - targetly engineered experience without so complex set and setting What? - Kanna alcaloids for premature ejaculation 😅 - BPL-003 for Treatment Resistant Depression (TRD). - IHCH-7113 Non halucenogetic psychedelic for depression - Ele-101 for depression and Alcohol Use Disorder (AUD). How? 1. AI assisted search - Predictive AI. Train on structure to properties (need big dataset of both) - Generative AI. Evolutionary machines 2. Natural compounds search and enchantment - Research existing less popular natural compounds rom indigenous communities - Enchance properties (Increase a half life, change blood barrier penetration, etc.. 3. Future approaches - computational chemistry (compounds VS receptors ) - test on brain organoids Skill level: #intermediate https://youtu.be/BQoIozpBU5Y

https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5saWJzeW4uY29tLzgxODk1L3Jzcw/episode/NjgxMmNkZTUtYThmZi00OWIxLThkMmMtZGU5NGM4MDQ2YjRl?ep=14 Why MDMA analogs? 1. Safer options for mory risky categories of people: People with Cardiac deseas history People over the age of 65 2. Other medical application apart form PTD Social anxiety for Autism Parkinson's desease 3. Other impoovements Shorter therapy duration More cheaper production Skill level: #intermediate

Researchers Are Mapping DMT Dimensions Through DMTx Tech Seems like DMTX is finally started and we will see more exciting news from various labs all over the world. Any friends anesthesiologists?😁 "But that doesn’t mean we can’t have some kind of mapping. One can think about Level mapping for example, so do different levels of intensity experience reliably take you to different types of spaces? Is there a progression? I mean people talk already, about you know, moving to the waiting room and then the dome. There has already been developed in a very informal sense, a certain kind of mapping of the space.” Skill level #intermediate https://psychedelicspotlight.com/researchers-are-mapping-out-new-dimensions-through-dmtx-technology/

English With Natives*

@sirjimmy · Post #31213 · 10.10.2024 г., 05:11

1️⃣How often does he work? Everyday All day Rarely 2️⃣What is he starting to think about? Playing basketball Watching TV His health Work 3️⃣What decision is made to get more exercise? Running or Jogging Doing more outdoor activities Going to the local gym 4️⃣What type of lessons are they considering? Dance Tennis Basketball 5️⃣For $120, How often will they meet? Everyday for a month Once a week for two months Every afternoon Twice a week for one month 6️⃣Please fill the blank and tell me what does whole sentence mean? Playing tennis twice a week will be a good start. ..... me .... . #Listening #Intermediate #Teamjimmy @Sirjimmy

English With Natives*

@sirjimmy · Post #30337 · 19.05.2023 г., 07:30

1️⃣How often does he work? Everyday All day Rarely 2️⃣What is he starting to think about? Playing basketball Watching TV His health Work 3️⃣What decision is made to get more exercise? Running or Jogging Doing more outdoor activities Going to the local gym 4️⃣What type of lessons are they considering? Dance Tennis Basketball 5️⃣For $120, How often will they meet? Everyday for a month Once a week for two months Every afternoon Twice a week for one month 6️⃣Please fill the blank and tell me what does whole sentence mean? Playing tennis twice a week will be a good start. ..... me .... . #Listening #Intermediate #Teamjimmy @Sirjimmy

English With Natives*

@sirJimmy · Post #30259 · 28.04.2023 г., 06:37

1️⃣How often does he work? Everyday All day Rarely 2️⃣What is he starting to think about? Playing basketball Watching TV His health Work 3️⃣What decision is made to get more exercise? Running or Jogging Doing more outdoor activities Going to the local gym 4️⃣What type of lessons are they considering? Dance Tennis Basketball 5️⃣For $120, How often will they meet? Everyday for a month Once a week for two months Every afternoon Twice a week for one month 6️⃣Please fill the blank and tell me what does whole sentence mean? Playing tennis twice a week will be a good start. ..... me .... . #Listening #Intermediate #Teamjimmy @Sirjimmy

12
ПретходнаСтраница 1 од 2Следна