Заметка начинающим, которые часто сталкиваются с подобной непоняткой.
Ситуация следующая, есть список файлов:
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
#pronunciation
@fluencyinenglish
❇️Top consonant mistakes of Farsi speakers
@fluencyinenglish
1. Say D instead of a hard TH (sounds like day instead of they)
2. Say T instead of a soft� TH (sounds like tin instead of thin)
@fluencyinenglish
3. Say V instead of W (sounds like vine instead of wine)
4. Do not use voicing at the end of words (sounds like cap instead of cab)
5. Do not use sounds at the end of words (sounds like flow instead of float)
@fluencyinenglish
6. Say a sound before consonant blends (sounds like eschool instead of school)
7. Roll R’s (sounds like rrrrrrrrrright instead of right)
@fluencyinenglish
Heist - [Hi-est] - [HIGH-ist]
Because of that famous series Money Heist on Netflix often we use the word heist in our conversation. Sadly most of us make a mistake to pronounce it. Here is the CORRECT pronunciation of the word "HEIST". [American accent]
#pronunciation
😳The words миллион [mi-li-on] (million) and миллиард [mi-li-ard] (billion) can now be pronounced as [мильон]=[mil'-yon] and [мильярд]=[mil'-yard].
🔻These two permissible variants have been approved by the Vinogradov Russian Language Institute of the Russian Academy of Sciences.
🔻The changes are documented in the dictionary on the institute's website.
🔻They also apply to derived words, including from миллионный [mi-li-on-nyj] to [мильонный]=[mil'onnyy] (the millionth), and миллиардный [mi-li-ard-nyj] to [мильярдный]=[mil'-yard-nyj].
🔻Previously, the institute's experts stated that the stress in the word звонит [zva-nit] (he/she rings/calls) would shift to the first syllable.
▶️More details about Звонит
What is this world coming to...
#news
#pronunciation
😎RCR | Support | Boost
😅Stay strong, comrades! These are not the most difficult words to be pronounced in Russian.
• Одна тысяча километров
[ad-na ty-si-cha ki-la-met-raf]
One thousand kilometers
🔻A colloquial variant:
• Одна тыща километров
[ad-na ty-shcha ki-la-met-raf]
🎧🗣👇
😉Would you dare to pronounce this in the comments?
#pronunciation
#learnRussian
😎RCR | Support | Boost
Не река, а мечта логопеда!
Not a river, but a speech therapist's dream word!
❤️🔥And do you know that learning is always about overcoming yourself through misunderstanding, difficulties, and mistakes? It's very challenging, but it's precisely this that yields the best results.
Therefore, when I see such complex words or tasks, I always feel happy for my students - they have a chance to overcome themselves and grow in their own eyes (and in mine too!).
🤩OK, comrades, it's a challenge!
❗️Can you pronounce this?
• река Хольненгпухырьёхан
[ri-ka khol'-nen-gpu-khy-r'yo-khan]
📎This river is located in
Khanty-Mansi Autonomous Okrug, in Tyumen Oblast, Russia.
#linguistic_joke
#pronunciation
😎RCR | Support | Boost
Listen to the audio and choose the correct spelling for this famous sauce:
A) Worchestershire sauce
B) Wosterchire sauce
C) Worstershire sauce
D) Worcestershire sauce
Follow 🌎@languagetrivia for more interesting questions
#pronunciation#spelling
Stress changes meaning — but you have to hear it to notice it 👂
Some English words look the same as nouns and verbs,
but the stress moves — and it sounds very different.
Watch these short videos to actually hear it:
📹https://youtu.be/Hh1PlngNt2Q?t=64
📹https://www.youtube.com/watch?v=7q8yk896pnc
Listening is the only way you’ll spot the difference.
Try saying these aloud after you watch 🎤
#EnglishLearning#Pronunciation#RealEnglish
Since there's a heated debate in ourgroup chat (@RCRussian2) about the longest Russian words, I'm adding fuel to the fire, comrades! 🔥
⬇️Here are some of the most famously long words:
🔢Превысокомногорассмотрительствующий (35 letters)
[pre-vy-so-ka-mno-ga-ras-smat-ri-tyel'-stvoo-yoo-schiy] His/Her Exceedingly-Many-Looking-Into-Things Excellency (An archaic, excessively obsequious title)
🔻Record: Listed in the Guinness World Records in 2003.
🔢Сельскохозяйственно-машиностроительный (37 letters)
[sel'-ska-ha-zyay-stvin-na-ma-shi-na-stra-i-tyel'-nyj]
Pertaining to agricultural machine construction.
🔻Record: The longest hyphenated adjective.
🔢Автоэлектростеклоподъёмники (27 letters)
[av-ta-i-lek-tra-sti-kla-pad-yom-ni-ki]
Auto-electric window lifts
🔢Человеконенавистничество (24 letters)
[chi-la-ve-ka-ni-na-vi-sni-chi-stva]
Misanthropy (hatred of humankind)
🔢 Who dares to risk their sanity and try to pronounce this wonderful verb?
• Переосвидетельствоваться
(24 letters)
[pi-ri-a-svi-de-til'-stva-va-tsa]
To be re-examined (officially, e.g., by a medical board).
🎧🗣👇
Who will dare to pronounce these words?
#russian_language
#longest_words
#learn_russian
#pronunciation
😎RCR | Support | Boost
در IELTS Speaking، خصوصاً Part 3، نمره شما بر اساس مهارت زبانی (Fluency & Coherence, Lexical Resource, Grammatical Range & Accuracy, Pronunciation) داده میشود، نه میزان اطلاعات عمومی یا صحت factual.
✅ راهکارهای عملی
1. از تردید کردن نترسید و صادق باشید
جملاتی مثل:
“I’m not an expert in this field, but I think…”
“I don’t know much about this, although it seems that…”
به شما اجازه میدهد بدون توقف ادامه دهید.
2. استفاده از speculation یا حدس منطقی
وقتی نمیدانید، میتوانید با حدس منطقی نظر بدهید:
“It might be because…”
“Perhaps this will lead to…”
3. مثال شخصی یا تجربه روزمره بیاورید
“From my own experience…” یا “In my city/school…”
حتی اگر اطلاعات عمومی کم باشد، مثال شخصی به طولانیتر شدن پاسخ و انسجام کمک میکند.
4. تمرکز روی انسجام و روانی صحبت
از ضمیرها و ربطدهندهها (this, that, these, however, on the other hand) استفاده کنید تا جملهها به هم وصل شوند.
5. استفاده از واژگان پیشرفته و ساختارهای گرامری متنوع
به جای تکیه روی اطلاعات، از واژگان دقیق و اصطلاحات متداول آیلتس استفاده کنید:
“plays a pivotal role”
“poses a significant challenge”
“from my perspective”
🔹 نمونه پاسخ با speculation
Q: Do you think governments should invest more in renewable energy?
> “I’m not fully aware of all the policies, but I think governments should invest more in renewable energy. It might help reduce pollution and create new jobs. For example, building more solar farms could provide electricity for many households. Although I don’t know all the details, it seems like a positive step for the future.”
#IELTS#IELTSSpeaking#SpeakingTips#Hedging#Speculation#Fluency#Coherence#LexicalResource#Band8#آیلتس#Part3#EnglishSpeaking#LanguageTips#AdvancedEnglish#Pronunciation