31 ESSENTIAL Python String Methods

  Рет қаралды 81,260

Patrick Loeber

Patrick Loeber

Күн бұрын

Strings are an essential data type in Python that are used in nearly every application. In this tutorial we learn about the 31 most important built-in string methods.
Get my Free NumPy Handbook:
www.python-engineer.com/numpy...
✅ Write cleaner code with Sourcery, instant refactoring suggestions in VS Code & PyCharm: sourcery.ai/?... *
⭐ Join Our Discord : / discord
📓 ML Notebooks available on Patreon:
/ patrickloeber
If you enjoyed this video, please subscribe to the channel:
▶️ : / @patloeber
~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
🖥️ Website: www.python-engineer.com
🐦 Twitter - / patloeber
✉️ Newsletter - www.python-engineer.com/newsl...
📸 Instagram - / patloeber
🦾 Discord: / discord
▶️ Subscribe: / @patloeber
~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
🅿 Patreon - / patrickloeber
#Python
Timeline:
00:00 - Intro
00:18 - 1. Slicing
00:40 - 2. strip()
02:10 - 3./4. lstrip() and rstrip()
02:35 - 5./6. removeprefix() and removesuffix()
03:16 - 7. replace()
03:37 - 8. re.sub()
04:25 - 9. split()
05:02 - 10. rsplit()
05:24 - 11. join()
05:50 - 12./13./14. upper(), lower(), capitalize()
06:07 - 15./16. islower() and isupper()
06:25 - 17./18./19. isalpha(), isnumeric(), isalnum()
07:05 - 20. count()
07:22 - 21. find()
08:07 - 22. rfind()
08:20 - 23./24. startswith() and endswith()
08:35 - 25. partition()
09:04 - 26./27./28 center(), ljust(), rjust()
09:45 - 29. f-Strings
10:26 - 30. swapcase()
10:40 - 31. zfill()
----------------------------------------------------------------------------------------------------------
* This is an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏

Пікірлер: 86
@YM-lm8xr
@YM-lm8xr 2 жыл бұрын
this is great content and format, please bring us more of this kinda summary !!
@dilyornematjon1526
@dilyornematjon1526 Жыл бұрын
asd
@lawrencedoliveiro9104
@lawrencedoliveiro9104 Жыл бұрын
3:09 Just a note that removeprefix and removesuffix are only available in 3.9 or later.
@HeyImAK
@HeyImAK 2 жыл бұрын
Great run-through. Will definitely watch again before starting a string-heavy project.
@gustavojuantorena
@gustavojuantorena 2 жыл бұрын
Great format. Super useful!
@susanafl3x
@susanafl3x Жыл бұрын
Thanks for the examples!
Жыл бұрын
Awesome! Thank you for the great content!
@scottterry2606
@scottterry2606 2 жыл бұрын
Great job! To the point and useful.
@patloeber
@patloeber 2 жыл бұрын
Glad you think so!
@Viktoriad3
@Viktoriad3 Жыл бұрын
Great video, helped me a lot :)
@barristar9338
@barristar9338 2 жыл бұрын
Thanks for this, so useful
@duck9597
@duck9597 2 жыл бұрын
Thank you for the video
@gboyeegs
@gboyeegs Жыл бұрын
awesome content for a beginner!!!
@dhineshbabu9376
@dhineshbabu9376 2 жыл бұрын
This is really cool bro. Please make more such useful summaries. Thank you
@patloeber
@patloeber 2 жыл бұрын
Thanks, will do!
@alyssonmachado1254
@alyssonmachado1254 2 жыл бұрын
Great video! I loved the tips, they are very useful!
@patloeber
@patloeber 2 жыл бұрын
Glad you like them!
@dilyornematjon1526
@dilyornematjon1526 Жыл бұрын
bullshit video
@justinlee1250
@justinlee1250 2 жыл бұрын
It is very useful as my quick reference of string methods, thanks.
@patloeber
@patloeber 2 жыл бұрын
Glad it was helpful!
@cancan740
@cancan740 Жыл бұрын
very goog video , i learned a lot , thanks
@rinuhasinikarthik5544
@rinuhasinikarthik5544 Жыл бұрын
this is extremely good content
@name1355_0ne
@name1355_0ne 2 жыл бұрын
Thank you, some of the methods were unknown to me
@Stelaninja
@Stelaninja 2 жыл бұрын
Thought I knew the most string methods. But I was wrong! Great video!
@patloeber
@patloeber 2 жыл бұрын
haha same for me before creating this video :D
@haisomeone2218
@haisomeone2218 Жыл бұрын
Thanks . I knew everyone of it 😁😁
@user-yw5jc1fi2l
@user-yw5jc1fi2l 2 жыл бұрын
ty we need more :)
@brookhaile6862
@brookhaile6862 Жыл бұрын
fantastic!
@anAlokDubey
@anAlokDubey 2 жыл бұрын
Great video!!! 😀👍
@patloeber
@patloeber 2 жыл бұрын
Thank you! 😀
@anirbanc88
@anirbanc88 Жыл бұрын
awesome sir
@sukritiguin5637
@sukritiguin5637 Жыл бұрын
Just Awesome❤❤❤❤❤❤❤❤
@tomblankenship8838
@tomblankenship8838 2 жыл бұрын
thank you very much, i just wonder in the minute 2:08 the strip method why doesnt remove the m in the example word, thanks in advance, great great gift your teachings thank you!
@xk999
@xk999 Жыл бұрын
Because the strip method only works for characters located at the beginning or at the end of a string
@vlogofjagathies6287
@vlogofjagathies6287 Жыл бұрын
Thanks you so much... I am a 1st year college student before to go to the collage I am started to learning computer languages and successful learned c,cpp and entered to learn python and studying but python is not easy to learn comparing to c, cpp. And get exactly stuked at this topic and now I am clear about this so thank you so much... 😄😄😄
@hemanthmuvvala5652
@hemanthmuvvala5652 2 жыл бұрын
Lots of love
@datamaniac2048
@datamaniac2048 2 жыл бұрын
Keep it up!
@patloeber
@patloeber 2 жыл бұрын
I will!
@snthabd2836
@snthabd2836 Жыл бұрын
Thanks,
@lawrencedoliveiro9104
@lawrencedoliveiro9104 Жыл бұрын
4:14 That only works because “s” has no special meaning after “\”. To be safe in general, you should double the backslash, or use a raw string literal.
@ObryanPoyser
@ObryanPoyser 2 жыл бұрын
Thx!!!
@patloeber
@patloeber 2 жыл бұрын
You're welcome!
@__________________________6910
@__________________________6910 2 жыл бұрын
Nice !
@patloeber
@patloeber 2 жыл бұрын
Thanks!
@si24.with.u
@si24.with.u 2 жыл бұрын
tnx
@charleslc1853
@charleslc1853 2 жыл бұрын
it's helpful
@patloeber
@patloeber 2 жыл бұрын
thank you!
@StarFury2
@StarFury2 2 жыл бұрын
Been learning Python for 2 months, watched many great videos, but this is probably the most efficient 10 minutes! Keep up the great work. I know all this is in official documentation, but it's so much better learning with a narrator and examples. I just wish I found this video earlier as it would save me hours of stackoverflow parsing.
@cvaldes__
@cvaldes__ Жыл бұрын
Just curious, how far have you come along now that its been almost a year?
@StarFury2
@StarFury2 Жыл бұрын
@@cvaldes__ I feel quite confident with python now, stopped watching tutorial videos, and actually focused on creating unique stuff I need for my work. You never stop learning of course, but you become more confident learning from official documentations and start examining python package files you just downloaded, rather than just blindly importing them in your project. I think this is the important milestone telling you've transit from beginner to intermediate user.
@cvaldes__
@cvaldes__ Жыл бұрын
@@StarFury2 Thanks for the reply! It inspires confidence just to know that if I stick to it, eventually things should begin to click. I'm currently on my second month as well and struggling with OOP... Any wisdom or tips you can impart on a beginner that maybe helped you as well?
@StarFury2
@StarFury2 Жыл бұрын
@@cvaldes__ Yeah, the key is to really stick to it, have patience and spend as much time coding as you can. Progress is slow, but it's also steady. Many would get frustrated and give up, some will push through and it will pay off in the end. OOP gets incredibly useful when you start to work on larger programs, but it's super confusing in the beginning. I watched one OOP tutorial video after another, repeating learning same concepts like attribute, instance, self, method types, inheritance etc. over and over again, giving them time to sink in while practicing using them in my own programs. As time goes by, it becomes more and more about what you want to do, and less about how do you do it.
@kris_maussen
@kris_maussen 2 жыл бұрын
Is there in python something like stringbuffer /stringbuilder? Correct me if I'm wrong but in Python strings are unmuttable ... not?
@Juanjo-do4qz
@Juanjo-do4qz 2 жыл бұрын
El mejor video
@zsoltbr
@zsoltbr 2 жыл бұрын
'This' must be his favorite word.
@justaduckcallednerimo
@justaduckcallednerimo 2 жыл бұрын
why did the lstrip remove all the way to r (Arthur: three)?
@PrivacyEnt
@PrivacyEnt Жыл бұрын
1:56 waitt why it didn't remove the m from example, making it exaple?
@higheloguy9057
@higheloguy9057 2 жыл бұрын
how about changing replace method, so you can pass list of strings as 1st argument
@dominion2734
@dominion2734 2 жыл бұрын
Ehre!
@eatbreathedatascience9593
@eatbreathedatascience9593 2 жыл бұрын
Thanks.
@patloeber
@patloeber 2 жыл бұрын
You're welcome
@mrmedbedb1256
@mrmedbedb1256 2 жыл бұрын
Штуки 4 финтов не знал :) А zfill нужен как раз!
@hackingdevice7953
@hackingdevice7953 2 жыл бұрын
Simply useful... Just need to memorize the name of methods😂
@gorand1018
@gorand1018 2 жыл бұрын
3. zadatak n=int(input('upisi prirodan broj')) r={} for i in range (n): x=input() r.update({len(x):int(x)}) k=list(r.keys()) k.sort() g={} for i in k: g.update({i:r[i]}) print(i,g[i])
@saintelohim
@saintelohim Жыл бұрын
1:57 why the m in example is still there?
@x7.
@x7. Жыл бұрын
Didn't notice that lol, did you find an answer ?
@facundogoiriz7323
@facundogoiriz7323 2 жыл бұрын
strip and replace
@riskzerobeatz
@riskzerobeatz 2 жыл бұрын
Very useful if you're too lazy to go through the docs yourself :D
@patloeber
@patloeber 2 жыл бұрын
Very true!
@gorand1018
@gorand1018 2 жыл бұрын
1. zadatak s=input() k=s.split()#stavljamo svaku rijec iz stringa u listu i brojimo koliko clanova print(len(k))#ima lista s=s.replace('a','')#izbrise sve a iz stringa i umjesto njih doda nista print(s) br=0 for i in s: if i.isupper(): #metoda pomocu koje gledamo jeli to slovo veliko slovo br=br+1 print('ovoliko je velikih rijeci u stringu', br) r={} for i in k: r.update({len(i):i}) #za svaku rijec u listi k gledamo koliko ima slova print(r)#pomocu len(i)
@XAUGoblin
@XAUGoblin Жыл бұрын
Which methods are the most useful and used in coding very frequently? I am a newbie in coding and I want to understand and memorize the functionality of the most important string methods among all the methods mentioned in the video.
@therabidpancake1
@therabidpancake1 Жыл бұрын
So you are saying that there are a limited number of strings that tha we nan use in Python ? You just showed us 31
@brightaneva6282
@brightaneva6282 2 жыл бұрын
First in comment
@patloeber
@patloeber 2 жыл бұрын
yeah
@ramupoonjolai9974
@ramupoonjolai9974 2 жыл бұрын
Hi, you are doing good. One suggestion to you. You need to give a moment break between sentences. Since you continuously talk from beginning to end of video, i have to go foreward backward to understand you completely. If you emphasize on certain point, give a second break so we can get it and going. Otherwise your videos are very informative.
@patloeber
@patloeber 2 жыл бұрын
Thanks for the feedback! I try to improve this next time
@skl9942
@skl9942 2 жыл бұрын
I don't agree, I really enjoy the fast-paced style.
@patloeber
@patloeber 2 жыл бұрын
@@skl9942 good to know :) seems like a lot of people enjoy the fast paces style...Probably there is not the perfect pace for everybody...
@greenhoodie
@greenhoodie 2 жыл бұрын
Fast paced is good. The pause button is there. It also shows you respect time by not fluffing it out 👍 Awesome video.
@franky12
@franky12 2 жыл бұрын
I also like the fast pace!!! There are so many youtube tutorials that are so incredibly slow and boring...
@AhadAli-bb3xj
@AhadAli-bb3xj 2 жыл бұрын
Such a perfect timing....preparing for tomorrow's python exam 😅😅
@patloeber
@patloeber 2 жыл бұрын
Good luck!!
@yavuzselimikizler814
@yavuzselimikizler814 2 жыл бұрын
Sj
@maybenew7293
@maybenew7293 2 жыл бұрын
man, breathe
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 598 М.
10 Python Basics You Should Know!
10:08
Patrick Loeber
Рет қаралды 78 М.
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 32 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 11 МЛН
Glow Stick Secret 😱 #shorts
00:37
Mr DegrEE
Рет қаралды 137 МЛН
ALL 47 STRING METHODS IN PYTHON EXPLAINED
23:34
Indently
Рет қаралды 112 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 786 М.
String methods in Python are easy 🧵
12:06
Bro Code
Рет қаралды 76 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
Python string slicing ✂️
11:37
Bro Code
Рет қаралды 56 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
6 Tips to write BETTER For Loops in Python
9:19
Patrick Loeber
Рет қаралды 244 М.
F-Strings Have A Lot of Format Modifiers You Don't Know
17:24
NeuralNine
Рет қаралды 11 М.
ALL 11 Dictionary Methods In Python EXPLAINED
9:26
Indently
Рет қаралды 47 М.
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 32 МЛН