No video

ALL 47 STRING METHODS IN PYTHON EXPLAINED

  Рет қаралды 127,904

Indently

Indently

Күн бұрын

Пікірлер: 158
@jumper0122
@jumper0122 Жыл бұрын
I feel like the most useful case where you'd use strip() was left out of this video. When used with no parameters, it strips spaces from the beginning and the end of a string. It's used all the time as the first step in sanitizing data from user input. I loved this video regardless though! I did not know about some of these, namely the weird fill ones
@StampleD2147AI
@StampleD2147AI 4 ай бұрын
Lol, I never knew that! I always just use split() with join haha
@comandanteej
@comandanteej 4 ай бұрын
Also the difference between strip and removeprefix: the first one takes a list of characters that may be removed multiple times, while the second one just removes the parameter as a single string.
@Wave1dave
@Wave1dave 3 ай бұрын
​@@StampleD2147AI Using split() and join() is still useful when trying to remove multiple whitespaces between words.
@andrasbekes
@andrasbekes 3 ай бұрын
And also removes new line character ( ), thats handy when reading from a file.
@kiryonnakira7566
@kiryonnakira7566 Жыл бұрын
Honestly, the format method deserves a video on it's own.
@arnowinter462
@arnowinter462 Жыл бұрын
And f-string as well....
@proxima458273
@proxima458273 6 ай бұрын
.format() should only be considered for legacy code. F-strings are far superior and should be chosen in every case they can be used… much like List Comprehensions should be chosen wherever possible.
@aalnajim
@aalnajim Жыл бұрын
One of the greatest videos about python strings I have watched on KZfaq. It is comprehensive! One thing I want to add is the difference between lstrip and removeprefix. The first one removes all the characters specified in its arguments starting from the left of the string until it faces a character that is not in the list of characters specified in its argument. So, print(‘Luigi gui guard’.lstrip(‘Luig ‘)) will print “ard” The second one removes the substring passed to it. So, print(‘Luigi gui guard’.removeprefix(‘Luigi ‘)) will print “gui guard” The same thing apply for rstrip and removesuffix I enjoy watching your videos. Keep the great work!
@midnightanna9925
@midnightanna9925 7 ай бұрын
I typed out every string method as I followed this video! omg we did it! Thank you for such a valuable video!! viewer: str = "{subject} is: {action}." print(viewer.format(subject="Midnight Anna", action="subscribing!"))
@dzendys_
@dzendys_ Жыл бұрын
The lstrip() was presented here very shortly and used only in one scenario. It is important to add that if the text was "someemos text", it would return " text". If you want to remove only the "some" from "someemos text", you can use removeprefix(). Be careful with this. Last thing someone mentioned it in comments was: "What if you didn't give it any parameters?" -> It would delete spaces only on the left side, if there had been some spaces ofc
@grzegorzryznar5101
@grzegorzryznar5101 Жыл бұрын
Thanks for video!. 1. For isalnum() also "_" is valid 2. ascii is pronounced as "aski"
@MuslimMan377
@MuslimMan377 6 ай бұрын
"_" isnt valid for isalnum() just checked 😊
@julians.2597
@julians.2597 6 ай бұрын
@@MuslimMan377 and neither is "1_000"
@rje4242
@rje4242 Жыл бұрын
one thing that makes sense for learning is to logically group operations together, like print(text.center(20,'*')) print(text.ljust(20,'*')) print(text.rjust(20,'*')) 3 alignments that take the exact same parameters. also, isspace() counts ALL whitespace as spaces - so tabs and linefeeds count as well, more useful than testing only for the space character.
@KinkyJalepeno
@KinkyJalepeno Ай бұрын
Love this video series - I'm documenting every single bit of them in my IDE as reference material
@sorin32
@sorin32 Жыл бұрын
Really nice video, thanks. on the endswith() you can also use another string not a single char, i.e. “apple”.endswith(“ple”)
@ProfRoxas
@ProfRoxas Жыл бұрын
yea, it's a bit misleading, since afaik python doesn't specifically have single characters and all these functions work with strings .replace() .startswith .endswith() etc
@GeoMan1217
@GeoMan1217 Жыл бұрын
I enjoy these types of videos. I've used Python for years now but find myself using methods I'm more familiar with, and making them work instead of using the correct method and saving time. Keep up the great work!
@Indently
@Indently Жыл бұрын
I’m the same, finding ideas like this to record is what I really enjoy doing, and even better if they help people :)
@amarnathmishra8697
@amarnathmishra8697 Жыл бұрын
Bruv , Make a cheat sheet for all 47 methods . You have covered everything . We need to have a cheat-sheet with examples handy.
@thinkinganame6173
@thinkinganame6173 25 күн бұрын
Great explanation and very useful
@user-bp5pq7hi7q
@user-bp5pq7hi7q 8 ай бұрын
brother this is the best video when i seen, short but all methods understandable
@cerealport2726
@cerealport2726 Жыл бұрын
As usual, I learned something new from this video! It's a really useful summary!
@chairfacenope5836
@chairfacenope5836 5 ай бұрын
This was very consice and easy to follow; thank you for the time stamps.
@muhammadaliqosimov7228
@muhammadaliqosimov7228 Ай бұрын
thank you for all explanations
@311DaveR
@311DaveR 4 ай бұрын
Love this, really nice refresher, and some that I was not aware of. Thank you.
@mohamed-triki
@mohamed-triki 9 ай бұрын
This video is literally GOLD !!!
@vasquezg86
@vasquezg86 10 ай бұрын
Great Vid! I'm learning Data Analytics rn using Python. Your content is helping me out. Thank you!
@mohamad_subhi
@mohamad_subhi 6 ай бұрын
i think this is the most useful video i've seen today thanks for your effort 😍
@Ibrohimtoshpolatov-gq6io
@Ibrohimtoshpolatov-gq6io 8 ай бұрын
wow bro thanks greets from Uzbekistan🙌👍
@azizbekbarotboyev8015
@azizbekbarotboyev8015 10 ай бұрын
A must-have video for beginners. thanks
@uvanana.
@uvanana. 7 ай бұрын
Thanks a lot :)
@facilvenir
@facilvenir 2 ай бұрын
Great video. Mot likely I'll have to come back eventually hahaha I really like your channel.
@perfect_man6263
@perfect_man6263 6 ай бұрын
its been a year! and still a wonderful video :)
@lte7151
@lte7151 Жыл бұрын
8:27 those numbers are Chinese
@KriptoKenYT
@KriptoKenYT Жыл бұрын
Thank you bro, im making sure im all refreshed for my final tomorrow lol
@kevon217
@kevon217 Жыл бұрын
Love videos like this. Thanks for sharing!
@mubaligh_e_azam_mission
@mubaligh_e_azam_mission 4 ай бұрын
Very very good lecture
@Anzeljaeg
@Anzeljaeg 2 ай бұрын
Amazing content ty
@chestnutmongrel
@chestnutmongrel 5 ай бұрын
I think it's worth mentioning that neither isdecimal() nor isnumeric() nor isdigit() return True for a line '-1', regardles the line is perfectly fine for int().
@irvinmuziwenkosi
@irvinmuziwenkosi Жыл бұрын
You are the best. Everything is well explained 🤩
@user-cp7jz2oh1m
@user-cp7jz2oh1m 9 ай бұрын
Thank you very much, your are a gift!!!
@lorak95
@lorak95 Жыл бұрын
Would be cool to do the same with DICTs and LISTs. Many thanks!
@charlesotoghile6547
@charlesotoghile6547 8 ай бұрын
Creating a function to run desired string function against each item on the list should solve this
@DaryaIbrahim
@DaryaIbrahim Жыл бұрын
Wazzaaap, even though the index was my best one for some personal reasons , I found both center and expandtabs very useful in my current project, thanks to you as always, and happy new year!
@frenamakenson9844
@frenamakenson9844 7 ай бұрын
thanks for sharing man, good explanation
@user-fe9em2sg8l
@user-fe9em2sg8l 5 ай бұрын
Thank you!
@Lets_code_together_
@Lets_code_together_ 5 ай бұрын
Thanks for the knowledge...................... it's just insane lecture
@user-te1jv3ub5l
@user-te1jv3ub5l 10 ай бұрын
You are superb ma bro ❤ i really understand your explanation
@callbettersaul
@callbettersaul Жыл бұрын
What's the difference between casefold() and lower()?
@dzendys_
@dzendys_ Жыл бұрын
casefold is more aggresive than lower -> example with german ß, casefold will make it ss but lower wont do anything
@callbettersaul
@callbettersaul Жыл бұрын
@@dzendys_ Thank you for the quick response :).
@trevorli2697
@trevorli2697 7 ай бұрын
Thanks for sharing, Big help! BTW, 8:30 those are Chinese numbers! hahhah
@okwudili6512
@okwudili6512 10 ай бұрын
Very useful video. Thanks a lot
@jondo-vh8tx
@jondo-vh8tx 8 күн бұрын
very nice video
@manzhizhang7194
@manzhizhang7194 10 ай бұрын
pretty useful videos, just in case, #17 are CHINESE NUMBERS!!
@kiryonnakira7566
@kiryonnakira7566 Жыл бұрын
0:52 xDD i saw that
@r.v.e3361
@r.v.e3361 9 ай бұрын
this is so good, Thx for that
@bruhlickd
@bruhlickd Жыл бұрын
Make one with all methods of OS library!!!!
@ericmunschi4655
@ericmunschi4655 Жыл бұрын
Very interesting and usefull ! Thanks
@theedspage
@theedspage Жыл бұрын
Thank you, this video is very informative.
@esergey12
@esergey12 Жыл бұрын
Very useful. Thanks 👍
@The-fishs-crypt
@The-fishs-crypt 2 ай бұрын
my brother in Christ that’s mandarin. Great vid btw 9:17
@munivoltarc
@munivoltarc 6 ай бұрын
Hi, could you make a video on functions of python from basic to advanced, and nested functions and class methods nested functions
@okporuanefeoghenevwegba5936
@okporuanefeoghenevwegba5936 Жыл бұрын
Thank you very much sir.
@richardboreiko
@richardboreiko Жыл бұрын
KZfaq says that two videos in the playlist are hidden - can you tell us what they are or unhide them?
@vishalprajapati1004
@vishalprajapati1004 Жыл бұрын
Very useful thank you sir❤
@whimsicalkins5585
@whimsicalkins5585 11 ай бұрын
Hellooo, 15:32 Guys. I loove this video
@LidaTheBishop
@LidaTheBishop Жыл бұрын
I LOVE YOU!☺
@KeithKazamaFlick
@KeithKazamaFlick 5 ай бұрын
great video . do more method vidoes
@sepehrhaghverdi8977
@sepehrhaghverdi8977 2 ай бұрын
I learn something new
@arunalakmal9031
@arunalakmal9031 6 ай бұрын
Thanks dude
@modeoinmoddle3995
@modeoinmoddle3995 Жыл бұрын
I didn't know there was an "isAshi()" method 🤣🤣🤣 (7:05)
@arnowinter462
@arnowinter462 Жыл бұрын
Me neither, I never heard "ASCII" pronounced that way... ;-)
@Harveydent2001
@Harveydent2001 4 ай бұрын
Gracias
@silver-wp7ky
@silver-wp7ky 9 ай бұрын
thank you!
@rezahajivand7498
@rezahajivand7498 Жыл бұрын
Hello . Thanks
@zeicold
@zeicold 3 ай бұрын
8:21 these are actually Chinese digis btw
@Almulikie
@Almulikie 10 ай бұрын
THANKS
@Indently
@Indently 10 ай бұрын
No problem
@bogdanborta8861
@bogdanborta8861 Жыл бұрын
I ❤ your videos! Good job
@magicvibrations5180
@magicvibrations5180 3 ай бұрын
What is the difference between casefold() and lower()?
@wantstocomment7092
@wantstocomment7092 8 ай бұрын
I remembered to comment. Was that wazzzaaap speedy?
@MohammadAsgharShah
@MohammadAsgharShah Жыл бұрын
Looking for some DATABASE functions like CRUD!!!
@misterkite7712
@misterkite7712 Жыл бұрын
Why do we need to use translate/maketrans? The replace method is really easier!
@vasunurukurthi5624
@vasunurukurthi5624 Жыл бұрын
rely very useful 😍😍
@phantom008varun4
@phantom008varun4 3 ай бұрын
Note guys these methods do not alter the actual data that variable is constant...
@mallninja9805
@mallninja9805 4 ай бұрын
Is casefold different from lower in any way?
@hlubradio2318
@hlubradio2318 4 ай бұрын
Hey is it just me or is VS Code faster in code suggestions eg AI
@moonilyas
@moonilyas 11 ай бұрын
Hi there, Great topic for strings, but if I want run the code in start of video it is not working code is as follow: def get_string_methods(): i: int = 0 for method in dir(str): if not in method: i += 1 print(i) print(i ,method, sep=': ') Is there any thing missing in the code?
@philtoa334
@philtoa334 Жыл бұрын
@Chuen666
@Chuen666 7 ай бұрын
I don't like to use "format()", just ues f-string, it's mort ez to understand and read
@user-fw3vs7tm1v
@user-fw3vs7tm1v 21 күн бұрын
startswith()
@ItsStaffDaddy
@ItsStaffDaddy Жыл бұрын
Can someone give a use case where .isprintable() would be important? I'm sure it is useful, but I can't think of anything.
@ItsStaffDaddy
@ItsStaffDaddy Жыл бұрын
Disregard, despite the internet not having anything, ChatGPT gave some good use cases for normalizing strings before tokenizing and feeding it into NLP models and such.
@jyvben1520
@jyvben1520 Жыл бұрын
detects \t \v \u \b ... in one function call, returns False if found any of them. can not test just on "\\" or chr(92) in text which could be normal. no need for if "\t" in text or " " in text or " " in text .... :
@thiyagua3188
@thiyagua3188 5 ай бұрын
Nice
@DerBarde2012
@DerBarde2012 5 ай бұрын
.lower and .casefold look similar to me
@largewallofbeans9812
@largewallofbeans9812 6 ай бұрын
Why exactly does .format_map(dict) exist? Couldn't you just do .format(**dict)?
@asmitdutta
@asmitdutta Жыл бұрын
can you make a finger counting app
@OnlyXaM
@OnlyXaM 7 ай бұрын
8:28 they are Chinese btw *
@BeardBarians
@BeardBarians Жыл бұрын
You could've used enumerate in the loop at the start!!
@Indently
@Indently Жыл бұрын
The count would not display properly with the code above because of the if check. But you're welcome to share some code and show me otherwise :)
@BeardBarians
@BeardBarians Жыл бұрын
@@Indently Ahh I didn't see the count before. After watching the video though, I thought would it be better to do if not method.startswith("__") instead of if not "__" in method as it would allow functions to have a __ inside of them, as well as not checking the whole string for the characters
@gardnmi
@gardnmi Жыл бұрын
@@Indently Here ya go. Thanks for the video. def print_methods(obj): methods = [m for m in dir(obj) if '_' not in m] for i, method in enumerate(methods): print(i + 1, method, sep=": ")
@Indently
@Indently Жыл бұрын
Isn’t this just a chatgpt output?
@BeardBarians
@BeardBarians Жыл бұрын
@@Indently Which one lmao
@benriakchangdar4963
@benriakchangdar4963 2 ай бұрын
cool
@kvelez
@kvelez 9 ай бұрын
Cool
@memo_force
@memo_force Жыл бұрын
What your IDE you use?
@joableandrosuarezcorrea1576
@joableandrosuarezcorrea1576 Жыл бұрын
what is the difference between replace() and maketrans()/ translate()
@shaheerhassan1157
@shaheerhassan1157 Жыл бұрын
which compiler u using?
@spaghettiking653
@spaghettiking653 Жыл бұрын
Probably CPython
@esphilee
@esphilee 6 ай бұрын
I fell asleep after the 5th.. ya.. somewhere around there..
@rondamon4408
@rondamon4408 5 ай бұрын
Only 50 minutes to record?
@hanying_0705
@hanying_0705 10 ай бұрын
This video is good, but In # 17, those are not Japanese numbers, they are Chinese numbers!
@richardboreiko
@richardboreiko Жыл бұрын
The c in ascii should be pronounced like a k, not sh.
@teabest2056
@teabest2056 2 ай бұрын
一二三四 is not a Japanese number, but a Chinese number
Жыл бұрын
How insert emoji into python code? :-)
@Indently
@Indently Жыл бұрын
Can you be more specific? Because you can directly type -> 🔥 for example and it will be in your code.
Жыл бұрын
@@Indently Specific? So, I dont know how to do it. You use at 13:49 some emoji as some character of string. But how I can type it? Its need for that some addon with browsing allowed emoji or what? You write "you can directly type" but how to directly type emoji of fire on keyboard?
@Indently
@Indently Жыл бұрын
Now I understand what you mean. On Mac I can do it by using a shortcut which gives me a small emoji table. You would have to search on Google whether there's an option for quick emoji insertion for your OS.
Жыл бұрын
​@@Indently So simply copy from somewhere and paste into code ? Ok, its seem easy. Btw thx for this video and video called "6 CLEAN Tips To IMPROVE Your Python Functions" , I learned a lot today. I subscribe you today.
@arham2549
@arham2549 Жыл бұрын
i commeted
@getstart98
@getstart98 7 ай бұрын
👍🙏
@grease253
@grease253 Жыл бұрын
Python gold
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 610 М.
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 14 МЛН
This Dumbbell Is Impossible To Lift!
01:00
Stokes Twins
Рет қаралды 36 МЛН
Parenting hacks and gadgets against mosquitoes 🦟👶
00:21
Let's GLOW!
Рет қаралды 13 МЛН
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 19 МЛН
5 Really Cool Python Functions
19:58
Indently
Рет қаралды 60 М.
5 Useful Dunder Methods In Python
16:10
Indently
Рет қаралды 58 М.
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 64 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 141 М.
How To Use List Comprehension In Python
6:41
Taylor's Software
Рет қаралды 7 М.
Software engineer interns on their first day be like...
2:21
Frying Pan
Рет қаралды 13 МЛН
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,7 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 802 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 507 М.
5 Useful Python Decorators (ft. Carberra)
14:34
Indently
Рет қаралды 98 М.
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 14 МЛН