Заметка начинающим, которые часто сталкиваются с подобной непоняткой.
Ситуация следующая, есть список файлов:
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
🍿 'Death of a Unicorn' Breaks the Mold
📆Release: Spring 2025
🎭Genre: #DarkComedy
A24 surprises with Alex Scharfman's directorial debut in this new film. Paul Rudd and Jenna Ortega star as a father and daughter who accidentally hit a unicorn, triggering a series of supernatural events. The plot masterfully blends sharp humor with effective horror.
Expect Will Poulter to steal the show with his natural charisma, while Paul Rudd brings his unmatched charm. I notice nods to classics like Evil Dead, making this a safe bet for genre fans. 🦄
🍿 ‘Nobody 2’: family vacation, bullets and chaos at the waterpark
📆Release: August 15, 2025
🎭Genre: #Action · #DarkComedy
Bob Odenkirk is back as Hutch Mansell, the world’s most overworked assassin, in a sequel that fuses ‘John Wick’ with Chevy Chase’s ‘Vacation’. This time, Hutch tries to unwind with his family at a theme park—until Sharon Stone shows up as a full-blown crime boss and Colin Hanks plays a shady small-town sheriff. Things go to hell, obviously.
Set to the iconic track Holiday Road, the trailer promises more bone-crunching fights, dark humor, and dysfunctional family drama. With Timo Tjahjanto (‘The Night Comes for Us’) directing, expect stylish mayhem and over-the-top action. Oh, and Christopher Lloyd wielding a Gatling gun? That alone makes this the summer movie to watch. It’s gonna be gloriously insane.
🍿 ‘Primate’: The Killer Ape Hollywood Has Been Afraid to Make 🐒🔪
📆Release: January 9, 2026
🎭Genre: #Horror · #DarkComedy
✈️Follow movie
Johannes Roberts (47 Meters Down, The Strangers: Prey at Night) directs this story about a group of friends enjoying a tropical getaway—until their family pet, a chimp named Ben, goes berserk after being bitten by something mysterious. What follows is ninety minutes of chaos, screams, and blood under the Hawaiian sun. ☀️💉
The trailer leans into the same absurd horror vibe that made M3GAN a hit and clearly nods to the chimp scene from Nope. The blend of terror and comedy is so shameless you’re never sure whether to laugh or hide behind your hands.
A brutal warning about human arrogance in trying to tame the wild… yet also proof that watching a monkey unlock a car with a key fob can be terrifyingly fun. 🧠💀
🍿 ‘One Battle After Another’: DiCaprio leads the revolution in Paul Thomas Anderson’s wildest ride yet
📆Release: September 26, 2025
🎭Genre: #DarkComedy · #Thriller · #Action
Leonardo DiCaprio (The Revenant, The Wolf of Wall Street) plays a chaotic, bathrobe-wearing ex-revolutionary on a desperate mission to find his daughter — and possibly save the world while he's at it. Paul Thomas Anderson (There Will Be Blood, Licorice Pizza) teams him up with Benicio del Toro (Traffic) as his deranged “sensei” and Sean Penn as a grizzled military foe.
Loosely inspired by Thomas Pynchon’s Vineland, this is more spiritual remix than straight adaptation. Shot on 35mm VistaVision with a reported $140M budget, it's Anderson’s most ambitious film yet. 🎬💥
This feels like PTA blending the absurdity of Inherent Vice with the emotional punch of Punch-Drunk Love. DiCaprio looks completely unhinged — and I’m 100% here for it. 🧨
🍿 Caught Stealing: Aronofsky lets loose — and it actually suits him
📆Release: August 29, 2025
🎭Genre: #Thriller · #DarkComedy · #Crime
⬇️Follow Movie
Austin Butler is just cat-sitting when things spiral out of control. Suddenly, he’s on the run through a gritty, gangster-infested 1990s New York — with punk neighbors (Matt Smith in a mohawk), Hasidic mobsters, and Zoë Kravitz as his emotional anchor. Aronofsky — yes, Black Swan and The Whale Aronofsky — feels like he binged Snatch and Lucky Number Slevin before directing.
And it works: this doesn’t smell like an existential meltdown, but rather a fast-paced pulp thriller with dirty visuals and dark humor. It’s his least depressing and most fun movie yet, without losing his flair for the grotesque.
📣Best part: the trailer doesn’t spoil everything — finally.
🤔The big question: is this a one-off or a new chapter? Either way, it looks like instant cult material.
🍿 Robert Pattinson Multiplies Himself in 'Mickey 17', Bong Joon Ho's New Madness
📆Release: January 31, 2025
🎭Genre: #ScienceFiction · #DarkComedy
🎟 Bong Joon Ho, the genius behind 'Parasite', returns with 'Mickey 17'. Robert Pattinson multiplies himself, literally!, in this adventure where his character, an 'expendable' (disposable), dies and is cloned over and over again on a mission to colonize an icy planet. 🧊
The most curious thing is the peculiar tone of voice Pattinson has adopted, which already has fans obsessed. Plus, the cast is top-notch: Steven Yeun from 'Minari', Toni Collette from 'Hereditary', and Mark Ruffalo from 'The Avengers'. If 'Parasite' left us speechless, I can't wait to see what Bong brings us this time. 🚀
🍿 The Phoenician Scheme: Benicio del Toro, a Nun, and Six Plane Crashes ✈️😵💫
📆Release: May 30, 2025
🎭Genre: #DarkComedy · #Espionage · #Action
🍿Follow movie
Wes Anderson (The Grand Budapest Hotel,Asteroid City) is back at his most eccentric: Benicio del Toro leads this visual satire as a bruised and armed tycoon who hands over his empire to his daughter, a knife-wielding nun played by Mia Threapleton (yep, Kate Winslet’s daughter). The cast is wild: Tom Hanks, Bryan Cranston, Richard Ayoade, Scarlett Johansson, Cumberbatch, and even Michael Cera in peak “Wes mode.”
Shot in Germany with a score by Alexandre Desplat, the film oozes Anderson’s signature nostalgic absurdity, but with a sharp rhythm that echoes his best work. Sure, the aesthetic is familiar, but when Wes nails it, it’s not formula, it’s pure style. And this one smells like a full-blown comeback. 🎨💣
🍿‘Send Help’: Sam Raimi Turns a Deserted Island into a Psychological Battlefield 🌴💀
📆Release: January 30, 2026
🎭Genre: #Horror · #DarkComedy · #PsychologicalThriller
✈️Follow movie
Sam Raimi —the mastermind behind The Evil Dead and the original Spider-Man trilogy— returns to his wildest roots with Send Help, his first non-franchise horror film since Drag Me to Hell. Rachel McAdams (Spotlight, Mean Girls) stars as Linda, an underappreciated employee stranded on an island with her boss from hell, Bradley (Dylan O’Brien, The Maze Runner), after surviving a plane crash. What begins as a survival story quickly turns into a darkly funny, blood-soaked power struggle for dominance.
What fascinates me most is how Raimi flips the hierarchy: the underdog becomes the predator 💪. Many are calling it a mix between Misery, Cast Away, and Triangle of Sadness —but with Raimi’s signature flair: grotesque, frantic, and wickedly fun. McAdams promises a full-on “Regina George in survival mode” performance, and that alone is worth the ticket. Raimi is back, and horror is groovy again.