11

Python Basics: File System Operations

 1 year ago
source link: https://realpython.com/courses/python-basics-file-system-operations/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Python Basics: File System Operations

So far, you’ve written programs that get their input from one of two sources: the user or the program itself. Program output has been limited to displaying some text in IDLE’s interactive window.

These input and output strategies aren’t useful in several common scenarios, such as when:

  • The input values are unknown while writing the program.
  • The program requires more data than a user can be expected to type in by themselves.
  • Output must be shared with others after the program runs.

This is where files come in. You’ve likely been working with computer files for a long time. Even so, there are some things that programmers need to know about files that general users do not. Specifically, you’ll want to master some file system operations using the pathlib and shutil modules.

In this video course, you’ll learn how to:

  • Create files and directories
  • Iterate over the contents of a directory
  • Search for files and folders using wildcards
  • Move and delete files and folders

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course. If you’re just getting started, then you might want to check out Python Basics: Setting Up Python before diving into this course.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK