+ os.getcwd() => get current working directory + os.chdir() => change directory + os.listdir() => list directory + os.mkdir() => create a directory + os.makedirs() => make directories recursively + os.rmdir() => remove directory + os.removedirs() => remove directory recursively + os.rename(, ) => rename file + os.stat() => print all info of a file + os.walk() => traverse directory recursively + os.environ => get environment variables + os.path.join(, ) => join path without worrying about / + os.path.basename() => get basename + os.path.dirname() => get dirname + os.path.exists() => check if the path exists or not + os.path.splitext() => split path and file extension + dir(os) => check what methods exists
@trigobrooken6260 Жыл бұрын
thank you best friend
@Freddietheking Жыл бұрын
Thank you best friend forever.
@manavgora Жыл бұрын
thanks bro
@clarity3208 Жыл бұрын
Thank you best friend
@banchanbet452411 ай бұрын
thank you bro
@dev_soda83152 жыл бұрын
its so sad that this guy has not uploaded any content for over a year now... his tutorials are always the best, most methodically thought out pieces of work on the platform
@iluvuvibez66442 жыл бұрын
You already finished all 143 of the python videos?
@Stopinvadingmyhardware Жыл бұрын
Nobody cares that some 15 year old girl working for the Mexican cartels goes around raping dude to try and extort them. Nobody gives a shit.
@pinnaclesystemsgroup6472 Жыл бұрын
I agree .. he is sorely missed
@pubgdoremongamer8823 Жыл бұрын
yeah right 😞
@texastitan6567 Жыл бұрын
He’s back in action now!
@chuanliangjiang73907 жыл бұрын
It is very excellent tutorial, much better than some paid python tutorial vedios in Udemy for i in range(1,1000000): print('Thank you so much for sharing this wonderful tutorial')
@Pr0G4m3R4u6 жыл бұрын
while True: print('Thank you so much for sharing this wonderful tutorial')
@greenballscience95146 жыл бұрын
(Python script is in c:/pyproj/thankyou.py) Import subsystem Subsystem.call([C://Python//Python.exe, C://pyproj//thankyou.py]) while True: Print(“Thank You So Much”)
@Nurtastube5 жыл бұрын
@@Pr0G4m3R4u 😂😂😂
@grad6grade5 жыл бұрын
@@greenballscience9514 it should be like: import os os.system(''C://Python//Python.exe, C://pyproj//thankyou.py")
@oberyn.freezingmoon5 жыл бұрын
Error, wait for script to finish.. .. CTRL+C >>> python Greenball_Science.py now you were saying?
@sreedharIITR7 жыл бұрын
For windows users, print (os.environ.get("HOME")) won't work as there is no HOME folder, instead it is USERPROFILE. So, type USERPROFILE instead of HOME.
@murakumo2227 жыл бұрын
THANKS A LOT!!! i just can't get it work until i saw this comment. but why i can't get it to search other folders? am i only able to search within the same tree?
@kostasnikoloutsos51727 жыл бұрын
Thank you. Now I made this who gives you the desktop path.Pretty useful if you want to create something in the desktop. os.path.join(os.environ.get("USERPROFILE"), "Desktop")
@AnthonyMute7 жыл бұрын
@murakumo222 I don't know if you finally did it but assuming you are referring to os.walk() you could do the os.walk('C:\\Users') replacing the string with whatever directory you want the tree on.
@cjz57577 жыл бұрын
Sukant Arora os.environ.get('HOME') works just fine for me
@MagnusAnand6 жыл бұрын
os.environ.get("HOME") worked fine for me in Windows 10
@codaadoc53026 жыл бұрын
A tutorial for the sys module would help tremendously. It's difficult to find someone like you who can explain things in such detail as well as show how useful certain things within python can be without half-assing it. Thanks, Corey.
@jordangillard26377 жыл бұрын
Bless your soul Corey! The os module has always been such a pain to learn. When you first see it in code it's so cryptic. Thanks for breaking it down for us!
@bactran77993 жыл бұрын
every time I need a tutorial video for Python, Corey is always the best one with really well organized, fully information and easily to remember. Thanks a lot Corey
@codingisthebest39142 жыл бұрын
Your grammar is wrong, the quote should be, "Every time I need a tutorial video for Python, Corey is always the best one with really well organized, full information and easy to remember. Thanks a lot Corey."
@einekleineente12 жыл бұрын
@@codingisthebest3914 Ich würde mal sagen,dass du ein Klugscheißer bist :)
@doodahgurlie2 жыл бұрын
@@codingisthebest3914 Based on his name, he's not American, so it's fine. I agree with what oneLittleDuck wrote in German. LOL
@NicolasChanCSY4 жыл бұрын
For anyone who needs to work with paths and don't want to deal with the forward/backward slashes difference between Linux, Windows, and MacOS, you can consider or at least take a look at the module `Pathlib`. It is simpler and easier to manipulate in my opinion. My favourite part of the module is its slash operator, e.g. taken from the documentation ```python >>> p = PurePath('/etc') >>> p PurePosixPath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') ``` Thus, you are free from the long `os.path.join()` method call introduced in 14:05 and make things cleaner and more readable.
@sujithnair2324 жыл бұрын
for Windows users I used HOMEPATH instead of Home , use SET Command to be able to see all environment variables on CMD print(os.environ.get('HOMEPATH'))
@knownwolf6 жыл бұрын
These Python videos are extremely helpful, thank you. I would be grateful if you added chapters. Some of the 10 minute plus videos have a lot of concepts and it would be great to jump back into a specific section when in need of a refresher. Keep up the excellent work and stay Pythonic my friend.
@greenballscience95146 жыл бұрын
Pythonic?
@khaled-dz83576 ай бұрын
The best one i have ever seen in teaching coding . Thank you so much man
@yomajo5 жыл бұрын
I never read your descriptions, but after seeing what's on your amazons' wish list, I can tell, you aint no ordinary tutor. Respect. Sharp, evolving mind.
@engr.mubasharhanif8 ай бұрын
hey are you programmer now?
@yomajo8 ай бұрын
@@engr.mubasharhanif Hey. still and will continue to hold myself newbie, but I do have production web app running that I charge the client for.
@salkdjfasldkfjsdlk7 жыл бұрын
You are very good at explaining Python modules and their practical uses.
@GihanJayaneththie4 жыл бұрын
Simple, well organized, great for beginners and informative. Nothing but least speaks English doesn't try to showoff.
@mubashirmuhib83393 жыл бұрын
From 00:02 The Os Module From 00:06 Os Module From 00:27 Import the Os Module From 01:31 Navigate to a New Location on the Filesystem From 04:32 Leading Folders From 05:27 Rename a File or a Folder From 10:09 Walk Method From 14:04 Os Path Join From 15:49 Os Path Base Name From 17:31 Split Ext
@sahajjaiswal10746 жыл бұрын
you are much better than my faculty handling python course....
@АлексейСоков-ь8и2 жыл бұрын
It is so demonstrating that you can hardly find any questions in the comments - there are only thanks and insparations 😏 The explanation is so clear that it leaves nothing to ask about 💎 Great job 👍
@veeresharadhya14308 жыл бұрын
please make one tutorial for sys module as well... :-)
@ivandrofly7 жыл бұрын
yeah thumbs up!
@Ryu23-x57 жыл бұрын
Yeah Corey! one for the sys module please! :)
@davidreynolds96497 жыл бұрын
and subprocess ;-)
@RaviTejaKalidindi6 жыл бұрын
and pdb debugger as well if possible :)
@beaconbecay16485 жыл бұрын
Veeresh Aradhya yes please. Been struggling with stdin and stdout
@misty_jeera3 жыл бұрын
Tip : if you are in windows, always use // instead of / while defining path names, otherwise you get errors apparently : ) Eg: os.chdir("C://Users//Desktop//text.txt")
@dostonbektoirov71102 жыл бұрын
Also, you can use r'C:/Users/Desktop/..' to make Python treat it as a raw string.
@turboromy7 жыл бұрын
I was surprised how quick that search was wth os.walk().... and at the same time, wondered why Windows "Find" takes so long. Thanks for the great teachings.
@zacharysimpson40256 жыл бұрын
I've been learning python for several months now, and not once did i ever see anything about print(dir())! Like given!
@erfantaghvaei39523 жыл бұрын
I love Corey's teaching ... and accent!
@MattWatsonHarmonica2 жыл бұрын
Thank you! I've been using the os module for years and had no idea about os.walk()! Will be putting this to good use!
@JoyDavidson Жыл бұрын
Corey, I hope you are well today. 🤙🤙 I have been sober for one year. We got this.
@kshitijkumar3267 жыл бұрын
This is an important suggestion for tutorials. Use Jupyter notebooks for tutorials. You won't have to erase your codes and output is line by line which is really easy to understand.
@coreyms7 жыл бұрын
I enjoy using Jupyter notebooks and have a video on how others can begin using them, but I have found that for tutorials it is best to stick with simple editors that beginners are more familiar with. They may become confused when their code with a notebook doesn't run top-to-bottom like a typical script. Thank you for the suggestion though. I will think more about it.
@rishabh.bharat4 жыл бұрын
@@coreyms exactly right sir Corey Scafer, you always think about your community....that's the real quality of a classic teacher :) ..also in Jupyter nb you may have to restart kernel or delete that cells to wash off unwanted variables from your code snippet..so I too think Sublime is best option from a learners point of view
@Setssquare2 жыл бұрын
Thanks a lot i started my cyber security journey yesterday , I was advised to learn this module thanks!!!!
@manuelch45893 жыл бұрын
Excellent! I really appreciate you sharing so much knowledge at no cost. I am getting it slowly. Thank you
@seanhogan3178 жыл бұрын
You are an excellent presenter. The details were very well explained. I learned a lot. Thank you
@soumyazyx5 жыл бұрын
Thank you Corey for your time and effort. Keep spreading the knowledge.
@jwarsame96618 жыл бұрын
Thank you Corey Schafer you're the best teacher for pyhton
@mr.curious17143 жыл бұрын
You are the greatest Python teacher
@MrKungfu2184 жыл бұрын
This was a very good video lesson for me as a beginner. I signed up for a Udemy class but found the content on OS Module functionality left me with some questions. I will definitely be using your videos as a resource1
@abeburdock77914 жыл бұрын
Which Udemy python class are you taking? I plan on taking a Udemy class for Python to supplement what I learn from Corey's channel. Thanks.
@sameerspl7 жыл бұрын
Thanks Corey. I have started following you.. You make things so simple when it comes to using necessary commands in python.
@nameless1914 жыл бұрын
Great tutorial straight to point teaching the stuff that actually creates complex programs in a simple way is great
@akira_asahi2 жыл бұрын
Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.
@HW-ct1iq6 жыл бұрын
Super good whistlestop tour. Just what I needed.
@jackieinspace6 жыл бұрын
Very nice! Tight and down to the core of what is needed!
@ABMA793 жыл бұрын
wonderful explanation.... Thanks a lot for making it more clear brother. you should honestly be a teacher.
@klamentyne59914 жыл бұрын
Extremely useful and explained so well...thanks Corey!
@mansimandlik90135 жыл бұрын
You teach in a interesting way sir ,Thanks Today i have learned all things i was trying to learn from many days
@chaitanyayeturi13123 жыл бұрын
First of all, your teaching style is good, and anyone grabs ur teachings easily, and thanks for teaching us. you are the best tutor I have ever come up with in python language. can u suggest any python language book, which is best to go through other than your channel? Moreover, I am a beginner to python language I thoroughly enjoyed ur videos, if u can suggest me best python book to ur sensibility and I guess it suits me and it helps me to learn further (I like physical like books). In case if u written any books related to this language can u suggest one (or) your favorite book, please......................................
@soumyazyx5 жыл бұрын
I am a huge fan of yours .. like countless others. I have been telling about this python playlist to each and everyone of my colleagues who are interested in python. I also emphasize that wander nowhere else. This is the place to be. On a side, How do you feel Corey to read such overflowing wonderful comments on you and your work? Would really like to know :)
@coreyms5 жыл бұрын
I'm extremely grateful for all of the kind comments. I love reading comments from you all each morning.
@carltechnologies28294 жыл бұрын
What a very helpful tutorial, I owe you more than a subscription
@SandraWantsCoke3 жыл бұрын
because windows uses \ backslash for directories, Python will think you're using escape characters, because that's what backslash is for. So, before the string put the letter r to indicate you're passing the raw string as it is. import os os.chdir(r'C:\Users\Adolf\Desktop') print(os.getcwd())
@kom_senapati Жыл бұрын
Yo this is included in summer analytics 2023 curriculum 👌
@LeirbagIII3 жыл бұрын
This si pretty interesting, Corey!! Thanks a lot for your help!
@edchelstephens2 жыл бұрын
Another excellent tutorial! 💯 Thanks a lot Corey 🙏
@Imran200919902 жыл бұрын
Don't know what to say.. excellent 👌👌👌👌
@cibelless5105 жыл бұрын
OMG, you are really good! Very clear voice and excellent explanation. Thanks for share.
@antonybelkovich70127 жыл бұрын
Corey , thank YOU at the highest degree !
@prabhavrajeev96824 жыл бұрын
Heres a summary of all the functions he introduced, Hope somefun finds it useful import os print(dir(os)) # list all methods associated with the module cwd = os.getcwd() # get current working directory print(cwd) os.chdir('path to change into') print(os.listdir()) # list everything in current directory os.mkdir('test-folder') # Make directory os.makedirs('lvl1/lvl2') # Make directory from folder structure os.rmdir('test-folder') # remove a single folder os.removedirs('lvl1/lvl2') # for removing recursively os.rename('org name','new name') # renaming a file os.stat('folder name') # returns an array of usual information os.walk('path') # traversing top down for dirpath, dirnames, filenames in os.walk('path'): pass os.environ.get('HOME') # get home env variable os.environ # get all environ variables file_path = os.path.join('path1','path2') os.path.basename('path') # gets filename from path os.path.dirname('path') # gets the directory name os.path.exists('path') # such a path exists os.path.isdir('path') # check if directory os.path.isfile('path') # check if file os.path.spiltext('path') # split extension from path for eg : (file_path without extension, file_extension)
@samhhhhh2 жыл бұрын
Excellent explanations and examples, thank you!
@divyasris92314 жыл бұрын
super super super. excellent teaching skills.
@heshankumarasinghe31594 жыл бұрын
An excellent tutorial. Learnt new stuff and this video helped me clear some doubts. Thanks a lot!!!
@justgivemethetruth7 жыл бұрын
Good, useful. Lots of stuff in the os module, that is for sure.
@sacredinclinations8 жыл бұрын
thanks for this video, clear and helpful and I learnt some new stuff. Please keep on releasing more!
@shirzadroohi30004 жыл бұрын
Thanks, it was very useful for me as a python beginner.
@karimkazia4 жыл бұрын
Thank you very very much for these videos. Learning a lot from your videos.
@dilshadomar50786 жыл бұрын
grate video am always around and always learning somthing new from the same video
@geetavishwakarma48833 жыл бұрын
Very informative and helpful. And also very well explained. Thank you
@moha_linus5 жыл бұрын
i'dont speak english but i understand what do u doing ur the bes bro ,, all love
@jignareshamwala34017 жыл бұрын
@Corey Schafer. Your tutorials are awesome! Thank you! :)
@gregoryfenn14627 жыл бұрын
Very helpful guide to such an import module :) thanks!
@Akashdoifode4 жыл бұрын
Thanks a lot for this video. Really helpful
@juliankercsik56414 жыл бұрын
Thanks Corey bloody good show old chap!!!
@ArunKumar-qy6fm5 жыл бұрын
Superb Corey. You are going beyond of our expectations. Keep it up.
@ramnageena885 жыл бұрын
this is my first comment in youtube I like this video good work
@heshankumarasinghe31594 жыл бұрын
Thank you for the video..... Learnt new stuff from this.....
@Tamer_Gomaa3 жыл бұрын
Awesome 👍🏼. Great explanation
@meowmeow704 жыл бұрын
Thank you Corey. Truly appreciate what you share.
@nolevel4333 жыл бұрын
Thats so brilliantly explained. Thanks a lot !!!!
@samsam84584 жыл бұрын
Hi Corey.. At 8:45 you suggested that os.walk yields a 3 value tuple.. I tried to check the type and can see-- Files are - Dir is Root is Can you please help me understand how I can get the values as tuple.
@ai.simplified..3 жыл бұрын
It,s 3rd min &i already loved it.
@laierr5 жыл бұрын
3:05 OS dot make DUURR
@bharath6954 жыл бұрын
I love this video tutorial just like many :-). As a systems admin, I would like to learn more about the os module. If possible you can make an advanced tutorial on this.
@shashik9625 жыл бұрын
This is different to improve knowledge of OS.
@vladn.23327 жыл бұрын
Thank you for the clear and concise explanation!
@MatiasEzelQ8 жыл бұрын
Amazing the simplicity of python :O
@hamedbakhti17524 жыл бұрын
Thanks bro!!! its very helpful... Good luck
@luisrosales30585 жыл бұрын
Great tutorial. Simple and straight.
@Samuftie4 жыл бұрын
very clear and precise. thank you.
@shriramkaucyk74916 жыл бұрын
Awesome one to start with. Just a lot of things.
@learnpy2583 Жыл бұрын
this guy is so clear,
@ravialwayswins7 жыл бұрын
Really really good stuff Corey!
@farmakoxeris5 жыл бұрын
7:39 What about doing it manually? What is the meaning of the number 1459929315.0? I suppose it's a number if seconds beyond a base date/time (perhaps 1/1/1900 00:00:00).
@kelvinmacharia37156 жыл бұрын
This a very good tutorial.Thank you Corey
@tav97554 жыл бұрын
Thanks for this very useful and well presented tut..
@Shlomojohn4 жыл бұрын
Really well explained thanks 👍🏻
@manjsc5 жыл бұрын
Really informative and very well explained. Thank you
@mcmormus3 жыл бұрын
Hey, can someone please explain when and why I get double slashes in some "path" strings? For example when I print(os.environ): "ALLUSERSPROFILE': 'C:\\ProgramData'"?
@smithocoro11404 жыл бұрын
Asombroso amigo eres asombroso como explicas, tiene un suscriptor
@suryakantmishra68667 жыл бұрын
simply awesome.. thanks Corey :)
@ji-axinliu44483 жыл бұрын
thank you Sir helped my work a lot
@paula980336 жыл бұрын
HI Corey, thank you for all the great videos. I disagree with you in regard to not having numbers for your videos! specially for people my niece who started learning python, it is great way of organizing her thought and building solid foundation of how to. PLEASE NUMBER YOUR VIDEOS.. SAVY USER THEY CAN SEARCH FOR THEIR TOPIC ACCORDIGLY. THANK YOU AGAIN FOR ALL YOUR HARD WORK. I WILL CONTRIBUTE $100.00 AS A ONE TIME CONTRIBUTION VIA MY CREDIT CARD.
@coreyms6 жыл бұрын
Thanks for the suggestion and thanks for the contribution! It helps more than you know!
@helpmenowmark7 жыл бұрын
This is sort of a related topic with importing (my personal library is called "common" or more specifically "common.py". On my particular computer I had to include the sys.path.insert(0, 'j:\\blender library\\scripts\\common\\') so that my other *.py scripts would recognise common.py. The real line of interest is reloading a module needs to be reloaded to obtain the lastest changes (without having to restart python). #import bmesh #import bpy import os import sys import importlib # clear the system.console os.system("cls") # make the default directory where my current script is running.... os.chdir("j:\\blender library\\scripts\\") # add the common directory so my modules can be found when called import sys sys.path.insert(0, 'j:\\blender library\\scripts\\common\\') # line(s) of interest - import my common module that I reuse over and over again import common # reload itself ... so any recent changes will be included (without having to restart python). common = importlib.reload(common)
@dilipwarrier51997 жыл бұрын
Thank you, Sir. Your videos are extremely helpful.
@cooleekova2 жыл бұрын
thank youuu! your tutorials are awesome!
@paulklimenko84192 жыл бұрын
the os.removedirs does it delete to recycle bin? or without recycle bin?
@paulklimenko84192 жыл бұрын
please anyone
@anthonyoyenuga76532 жыл бұрын
No, It doesn't. It permanently deletes the directory/directories.
@shazkingdom17025 жыл бұрын
now I understand this OS & good use case for file manipulation! THANK YOU COREY!
@sundareshbarana78606 жыл бұрын
Thank You Corey. Your videos are best one for python beginners.