To save you time, I put a list of all of the tips and the timestamps for each in the description of the video. And again, this video was sponsored by Skillshare. If you'd like to check out Skillshare with 2 free months of Skillshare Premium, you can use my link here: skl.sh/coreyschafer
Like I was saying in the video, zip will stop after the shortest list is depleted. zip_longest from the itertools module will go to the end of the longest list and have filler values for the shorter lists. Watch my video on itertools to see an example.
I'm 79 years old, been studying Python for about 6 months, and I got to tell you I get so damned exited with the stuff I learn from you - no other teacher, paid or free, has come close. I just hate to tear myself away from videos like this! I don't have a lot of money, but I'm gonna send you a few bucks - buy a toy for your beautiful dog. :)
@@elghazouanimohammed6639 I deal with cryptography and thus large numbers a lot. Having some human readable constants is nice, such as 2**32 if it were written out. Sometimes it even just helps for understanding "oh, it's like a billion" without having to break out the cursor to count each zero.
Your content is so unbelievably good! Thank you so much for all that you've taught me. You speak so clearly, describe concepts so well, demonstrate with perfection, you're incredible!
The work you do is priceless. Thank you so much, Corey! You are really wonderful teacher, who keeps to inspire me and others to move toward being a better developers.
His tutorials are exponentially much better than most of the Udemy & Coursera courses. You're doing a Great job Corey you're having an impact ❤️ Keep it up.
Although I didn't know about zip (8:52) and it does seem pretty helpful, it looks like you could get an equally organized structure if you use a dictionary instead since the two lists are inherently related and do something like: for name, hero in dictionary_name.items(): In any case, great video and I definitely managed to learn some things
Thanks a lot Corey - 3+ years and it helps 🙌 At 12:30 we can use: for index, (name, hero, universe) in enumerate(zip(names, heroes, universes), start=1): print(f'{index}: {name} - {hero} - {universe}')
Was sitting yesterday, passing values to object attributes(13of them), and ended up looping around dict and doing this: For item in dict: obj.attribute=item[‘index1’] obj.attribute2=item[‘index2’] Wish I knew about setattr... Thank you !!!Mr. Schafer
36:49 U accidentally delivered one more tip than you said (at least for me), u typed exit() to exit Python from terminal, while I used to import sys first from os, and then do sys.exit().. Thanks, you are one of the best teachers for me!!!👍🤗
Hey, Corey! Greetings from Mother Russia 👋🏻 Thank you for what you are doing! No water, just a facts with super clear examples. You’re making TH-cam better!
Your videos are amazing. So well explained. I feel I learn to code better every time I watch your videos, even if I already know the modules you introduce. Thank you so much!
Thank you for this trick, this is just I was looking for, and thank you for screen size, because there are tons of videos, where I can't see nothing, but your is great, thank you my friend.
This is the first time I've intentionally sat through the sponsor segment at the end of a video... not because I'm interested in Skillshare... just because you've more than earned that time from me.
Reading about those things (as someone who started with C and co) it's easy to forget. This video is a great summary of all the helpful functionalities we forget about.
This guys knowledge completely blows other tutorials out of the water! I know I’m late to the game Corey but your content is truly amazing thank you from 2023
First of all, I have to say that I'm very thankful for this videos. I am from Argentina and the part of "nosetuid" made me laugh a lot just because I instictibly separated it like "no se tu id" witch is Spanish for "I don't know your id"; I know, is silly, just wanted to share it with the comments people
Brilliant tips for typing code with high quality! New to Python! But i worked as a developer for a company for 1 year with AngularJS, I wish people cared more about this type of things! Thanks!
This is incredible. I absolutely love your delivery - you are such a good speaker. I've used your videos as a refresher and I want to thank you so much for your great archive of helpful videos!
Before I started the video I saw the 39 min length and thought, well okay give it a shot for 10 minutes and then scroll through. 10 minutes later I realized its 39 minutes later. Very sweet, thank you.
I'm just getting started by taking a couple online courses. Your videos really help to clarify the subject matter. You have the best Python videos on TH-cam.
Your videos are so high quality! All the info was very useful specially the dir(). God I wish i knew that earlier xD Thank you so much :) I followed your django tutorials and now have 4 good personal projects under my belt! Your tutorials were my foundation of Django. One thing I'd really want you to cover is unit tests. They seem to be a huge part of companies and I think its an important topic to cover and would be helpful to other viewers as well. Thank you so much once again for producing such high quality videos for us
For the topic you talked about roughly at 24:02 : If you have multiple attributes like this you don't neep to loop over them. It's easier to use .__dict__.update(). PS: Very nice video! ^^
very informative tips. thank you so much. 11:18 a tip if someone need to convert two lists of same length into dictionary then we can also use the zip function mydictionary=dict(zip(listA,listB)).
I've worked with Python for many years, and some of the features mentioned here are only in the most recent versions of python (like f-strings). I work in environments that have older versions of python (even the now obsolete Python2.7) without these features I think it would have been helpful if the version of Python where the feature was introduced was mentioned in the video. This is not meant to be a criticism, this video is great!
The package "Terminus" is a package that allows you to run the command line as a panel in sublime text 3. I personally use it in combination with WSL on my windows pc to simulate a Linux setup without having to run a VM.
Excellent video. I learned some of these the hard way writing spaghetti code and I think it's refreshing to have a breakdown with examples like these. Great work!
Hi Cory, just a few minutes into this video, your first 2 tips, use of ternary condition and enumerates, led me to come up with this class that would pretty much "act" like a substring on a list of elements. For example, if you wanted to just extract certain elements of a string. Full code is here: class mylib():
def getSubset(self): names = self.list_a en=enumerate(names) startpos=self.start endpos=self.end c=[] # initialize a new list for idx, name in en: # Append only if our criteria is satisfied. c.append(name) if (idx >= startpos and idx
3 questions (using the example you used for the file reading thing around 5:50): What does f mean? what does it mean when you use f. ? what does the ' mean? If you couldn't tell, I'm new to programming lol
The "f" represente the file (it's an object). It's like you open the file and then you call it "f" that's why there is the "as"' word. Then, you can appli to methods like read() or close() (f.read() and f.close())
Hi, can we please have tips on how can we make our code more reusable and understandable if we're working on a large scale project? Thanks. As always, the best tutorials on YT!
5 ปีที่แล้ว +4
Comment your Code and split your Code into small classes and files
Great video! Many thanks. Strong emphasis on the statement: You don't have to know everything, but it's more important to be able to find information and use it.
@Parker Anderson: your method is correct for sure but is not pythonic. The Python way of doing things tends to simplicity in code writing, hence the enumerate function. Even the fact that you can loop through a list with just "for item in items:" is something really easy to write and understand later.
I must say you 've provide very handful tips. After seeing this video I'm going to change my coding style. Your tips are certainly going to save lot of time.
Thank you Corey! Probably, anybody would like to use that case: 1) there is you can get the object: attributes_holder = type('attributes_holder', (), {}) 2) there is you are ready to init the object attributes. Corey described this. (setattr, getattr functions)
I appreciate your videos. But there are 4000 TH-cam videos on fundamentals of python, however only about 5 on how to solve issues. When I take a class or an interview they ask me to solve a problem and not syntax questions. I wish there were more videos on how to solve problems so I can see how the logic works and how to approach solving the problem.
To save you time, I put a list of all of the tips and the timestamps for each in the description of the video. And again, this video was sponsored by Skillshare. If you'd like to check out Skillshare with 2 free months of Skillshare Premium, you can use my link here:
skl.sh/coreyschafer
Thank you for the timestamps!
Hey Corey, please make a video on MRO (Method Resolution Order) in Python
Corey Schafer how we can loop 2 lists witout same lenth
Like I was saying in the video, zip will stop after the shortest list is depleted. zip_longest from the itertools module will go to the end of the longest list and have filler values for the shorter lists. Watch my video on itertools to see an example.
Please make a video on "How Django processes a request
?"
I'm 79 years old, been studying Python for about 6 months, and I got to tell you I get so damned exited with the stuff I learn from you - no other teacher, paid or free, has come close. I just hate to tear myself away from videos like this! I don't have a lot of money, but I'm gonna send you a few bucks - buy a toy for your beautiful dog. :)
God bless you... ☺️✨. Shine on...
@@joshkanyinda5569 tf is wrong with you. he's doing whatever he wants, making the most of life, unlike you obviously.
@@joshkanyinda5569 What a useless comment...
@@cloakedvisor agreed
tf is wrong with you
Enjoy!
1) 0:34 - ternary operator ;
2) 2:13 - Underscores in Numeric Literals + about f-string;
3) 4:29 - context manager ;
4) 6:49 - enumerate function ;
5) 9:01 - zip function ;
6) 13:46 - unpacking tuples (use asterisk and underscore);
7) 19:11 - getting and setting attributes to object (setattr, getattr );
8) 26:24 - getpass instead input (read from keyboard) ;
9) 29:22 - run python with dash m in terminal (python -m ...);
10) 32:32 - built-in functions (help, dir etc)
loviuuuuuuuuu
@@eujnia This is literaly in the description
@@ardonjr can u act like a normal person and just ignore me?
@@ardonjr Mobile users can't click the timestamps in the description.
@@za6604 Uh yes I can? I'm typing this from my mobile phone..
My favourite Channel for learning python
And best on TH-cam
Indeed ! he is quick to the point and no baloney
@@dr.rijjaayaz8160 Sorry, but the narrative voice is not nearly as pleasant as Corey Schafer's
I've been coding in Python over a year now, and was expecting to only see one or two new things. BUT I LEARNED SO MUCH MORE !
Thank You!
Dude, underscores can be used to delim numbers!? Literally life-changing tip, thank you!
Same XDDD
only python 3.6+
Can you give me an exemple where you need that please ?
@@elghazouanimohammed6639 I deal with cryptography and thus large numbers a lot. Having some human readable constants is nice, such as 2**32 if it were written out. Sometimes it even just helps for understanding "oh, it's like a billion" without having to break out the cursor to count each zero.
It is used to separate the multiple string. Ex. full_name = 'John'
As a Python beginner - but not a beginner in programming - this video was great! Awesome explanation, thank you!
Your content is so unbelievably good! Thank you so much for all that you've taught me.
You speak so clearly, describe concepts so well, demonstrate with perfection, you're incredible!
Thanks!
Corey, just thanks, man. That is all I can say for the content that you make here. I have learned so much from you
Thanks for the comment! Glad you've learned a lot!
The work you do is priceless. Thank you so much, Corey! You are really wonderful teacher, who keeps to inspire me and others to move toward being a better developers.
Thanks for the kind words!
Fantastic, 40 minutes of my life well spent.
His tutorials are exponentially much better than most of the Udemy & Coursera courses.
You're doing a Great job Corey you're having an impact ❤️ Keep it up.
Wow. Figured I'd watch a random python tips video instead of memes and found exactly what I needed for one of my projects. Thanks man! Awesome vid!
Although I didn't know about zip (8:52) and it does seem pretty helpful, it looks like you could get an equally organized structure if you use a dictionary instead since the two lists are inherently related and do something like:
for name, hero in dictionary_name.items():
In any case, great video and I definitely managed to learn some things
The best python teacher ...thanks corey sir..
Thanks a lot Corey - 3+ years and it helps 🙌
At 12:30 we can use:
for index, (name, hero, universe) in enumerate(zip(names, heroes, universes), start=1):
print(f'{index}: {name} - {hero} - {universe}')
Was sitting yesterday, passing values to object attributes(13of them), and ended up looping around dict and doing this:
For item in dict:
obj.attribute=item[‘index1’]
obj.attribute2=item[‘index2’]
Wish I knew about setattr...
Thank you !!!Mr. Schafer
You are the best teacher ever Corey! Learning tips and tricks like these can save a programmer a lot of time, so I really appreciate videos like these
Yea👍
Great video, thank you for sharing!
I watch your videos
Praise from Caesar 😅
day by day I am falling more and more in love with your teaching style
Those tips on unpacking were mindblowing to me; i never knew we could use those syntaxes. Great video!
36:49 U accidentally delivered one more tip than you said (at least for me), u typed exit() to exit Python from terminal, while I used to import sys first from os, and then do sys.exit()..
Thanks, you are one of the best teachers for me!!!👍🤗
As a new Python learner, I find your videos are the most interesting, clear and throughout! Glad that you still making python videos. Thank you!
Hey, Corey! Greetings from Mother Russia 👋🏻 Thank you for what you are doing! No water, just a facts with super clear examples. You’re making TH-cam better!
Your videos are amazing. So well explained. I feel I learn to code better every time I watch your videos, even if I already know the modules you introduce. Thank you so much!
Thank you for this trick, this is just I was looking for, and thank you for screen size, because there are tons of videos, where I can't see nothing, but your is great, thank you my friend.
I've been coding with python for a while, I've messed around with neural networks, yet somehow I didn't know some of these amazing tips. Thanks!
Corey is a genius at knowing what it is we need to know and knowing how to explain it simply and clearly.
Dude!!
What a great video!
Thanks you so much.
Please, continue bringing more videos
This is the first time I've intentionally sat through the sponsor segment at the end of a video... not because I'm interested in Skillshare... just because you've more than earned that time from me.
Reading about those things (as someone who started with C and co) it's easy to forget.
This video is a great summary of all the helpful functionalities we forget about.
Thank you for everything you do, Corey. Once again, I've learned an absurd amount of information in less than an hour.
so far, this is the best python channel i ever saw, best explanation, clean nice voice, thank you mr Corey
TH-cam : 10 python tips and tricks...
Me : Leave me alone please
TH-cam : ...from Corey Schafer
Me : *Instaclick*
Haha, thanks!
This guys knowledge completely blows other tutorials out of the water!
I know I’m late to the game Corey but your content is truly amazing thank you from 2023
Great tips and tricks! The best python instructor!
I clicked on this video thinking I would learn one or two things, but I've been shocked and impressed by each tip, this was very helpful!
Best Python Learning Channel!
The quality of this content.. insane. Thanks, Corey.
You are the best as usual Corey. Thank you so much for this valuable tutorial, you are really a life saver
The best programming teacher I've found in TH-cam!
First of all, I have to say that I'm very thankful for this videos.
I am from Argentina and the part of "nosetuid" made me laugh a lot just because I instictibly separated it like "no se tu id" witch is Spanish for "I don't know your id"; I know, is silly, just wanted to share it with the comments people
Brilliant tips for typing code with high quality! New to Python!
But i worked as a developer for a company for 1 year with AngularJS, I wish people cared more about this type of things!
Thanks!
A tip about unpacking with the star is great. Thanks a lot.
This is incredible. I absolutely love your delivery - you are such a good speaker. I've used your videos as a refresher and I want to thank you so much for your great archive of helpful videos!
Nice video... I didn't know about the start in enumerate. And that unpacking list bit was really good.
Before I started the video I saw the 39 min length and thought, well okay give it a shot for 10 minutes and then scroll through.
10 minutes later I realized its 39 minutes later. Very sweet, thank you.
Thanks mate. You just saved me tons of hours of hating myself. Great job!
I'm just getting started by taking a couple online courses. Your videos really help to clarify the subject matter. You have the best Python videos on TH-cam.
Thanks! Good luck getting started in programming!
Your videos are so high quality!
All the info was very useful specially the dir(). God I wish i knew that earlier xD
Thank you so much :)
I followed your django tutorials and now have 4 good personal projects under my belt! Your tutorials were my foundation of Django.
One thing I'd really want you to cover is unit tests. They seem to be a huge part of companies and I think its an important topic to cover and would be helpful to other viewers as well.
Thank you so much once again for producing such high quality videos for us
Yes, what are unit tests?
The best tips and tricks for all coders!
And I am still learning new cool stuff you can do in Python :) Thank you!
For the topic you talked about roughly at 24:02 :
If you have multiple attributes like this you don't neep to loop over them. It's easier to use .__dict__.update().
PS: Very nice video! ^^
Thanks Corey your channel isTHE best Channel for learning python
please if it possible a playlist for Data structure & Algorithms in python
very informative tips. thank you so much. 11:18 a tip if someone need to convert two lists of same length into dictionary then we can also use the zip function mydictionary=dict(zip(listA,listB)).
thanks for the free knowledge, from an aspiring developer
lot of people know python but only few knows how to tech or deliver it.. 👍
best free python tutorial available across youtube and internet..
I've worked with Python for many years, and some of the features mentioned here are only in the most recent versions of python (like f-strings). I work in environments that have older versions of python (even the now obsolete Python2.7) without these features I think it would have been helpful if the version of Python where the feature was introduced was mentioned in the video. This is not meant to be a criticism, this video is great!
I've worked with Python for a few years and have seen a lot of code out there but I didn't know all of the tips here. Thanks.
Just FYI, the underscore number separator only available from Python v3.6+
...
Thanks for pointing that out!
Also the f string place holder
It was added with v.3.6
Older versions have to use “ “.format()
IDK how but I have been using python for about 2(ish?) years now and most of these are brand new to me and HOLY CRAP DO THEY CHANGE SO MUCH
The package "Terminus" is a package that allows you to run the command line as a panel in sublime text 3. I personally use it in combination with WSL on my windows pc to simulate a Linux setup without having to run a VM.
Excellent video. I learned some of these the hard way writing spaghetti code and I think it's refreshing to have a breakdown with examples like these. Great work!
Hey! Corey that was great video tutorial . Get to learn lot of new things.
Happy Pythoning.
Hi Cory, just a few minutes into this video, your first 2 tips, use of ternary condition and enumerates, led me to come up with this class that would pretty much "act" like a substring on a list of elements. For example, if you wanted to just extract certain elements of a string. Full code is here:
class mylib():
def __init__(self, list_a, start, end):
self.list_a = list_a
self.start = start
self.end = end
def getSubset(self):
names = self.list_a
en=enumerate(names)
startpos=self.start
endpos=self.end
c=[] # initialize a new list
for idx, name in en:
# Append only if our criteria is satisfied.
c.append(name) if (idx >= startpos and idx
VEry cools zip tips
3 questions (using the example you used for the file reading thing around 5:50):
What does f mean?
what does it mean when you use f. ?
what does the ' mean?
If you couldn't tell, I'm new to programming lol
The "f" represente the file (it's an object). It's like you open the file and then you call it "f" that's why there is the "as"' word. Then, you can appli to methods like read() or close() (f.read() and f.close())
Great flow dude..
Ran into the same setattr problem couple times before, great video!
Hi, can we please have tips on how can we make our code more reusable and understandable if we're working on a large scale project?
Thanks. As always, the best tutorials on YT!
Comment your Code and split your Code into small classes and files
we need part2 Corey..It's really an awesome video.. Waiting eagerly for part2,3,4,5, --- infinity .. :) Keep posting awesome stuff Corey.
only 4 minutes in and I went off a wikipedia binge tangent that left me knowing everything about large number names in different scales and languages
Thank you very much for sharing this, as a data analyst using python on a daily basis some of these would make my life a lot easier! :D
from my_heart import thank
thank.you('for this brilliant and plain way of explaining python usage')
Just came across this channel and I subscribed right away.
This is my second video. I love your teaching 👍
Will u make a vid on tkinter or any other GUI?
Corey, wanted to give a like for every tip&trick out there... Thanks a bunch!!!
Great video! Many thanks. Strong emphasis on the statement: You don't have to know everything, but it's more important to be able to find information and use it.
I just solved a problem using zip thanks to this video. Thank you..
maybe this is just me being crazy, but i ALWAYS do loops like this:
for i in range(len(names)):
print(i, names[i])
but idk
nub...
So do I. I'm not a professional programmer, this works for me, no idea whether it is the ideal way of doing things.
This would be faster than enumeration. You could timeit yourself. I would prefer this one to enumeration
Why can't you do this
@Parker Anderson: your method is correct for sure but is not pythonic. The Python way of doing things tends to simplicity in code writing, hence the enumerate function. Even the fact that you can loop through a list with just "for item in items:" is something really easy to write and understand later.
You got the best tutorials i have found so far thanks for the good work man
You were sent from heaven.
I love these videos you make. They inspire me to try more Python things in my code.
Wait, Clark Kent is Superman?? no way, I've seen him, he weares glasses...
Thanks for the timestamps! Makes for a great reference video to save. And more likely to find when searching
These are like the new 10 commandments
I must say you 've provide very handful tips. After seeing this video I'm going to change my coding style. Your tips are certainly going to save lot of time.
"Not all python modules are this thicc."
Oh just like how not all youtube videos are this thicc? 🙂
Thank you Corey! Probably, anybody would like to use that case:
1) there is you can get the object:
attributes_holder = type('attributes_holder', (), {})
2) there is you are ready to init the object attributes. Corey described this. (setattr, getattr functions)
I appreciate your videos. But there are 4000 TH-cam videos on fundamentals of python, however only about 5 on how to solve issues. When I take a class or an interview they ask me to solve a problem and not syntax questions. I wish there were more videos on how to solve problems so I can see how the logic works and how to approach solving the problem.
Totally awesome video! Thanks Corey!
nose tuid xD. Exactly the way I read it as well the first time.
feels good to know some of this already as a somewhat beginner
"nose tuid" I am gonna remember it this way now. 😂😂😂😂
Great tutorial! A weekly '10 tips & tricks' would be VERY welcome and popular. You are an excellent teacher. :)
Have I told....you lately....that I love you? Hahaha
hahaha... he deserves the song... 🎶
Takin a bow!!! You are my Rafiki :)
how can I give you infinite likes?
Hello from brazil!!!
Make a script for it...
Thank you so much for setattr and getattr. It is amzing. Changed my whole codes.
NOSETUID got me. hahaha