O'Reilly logo

Python Recipes Handbook: A Problem-Solution Approach by Joey Bernard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Joey Bernard 2016

Joey Bernard, Python Recipes Handbook, 10.1007/978-1-4842-0241-8_4

4. Files and I/O

Joey Bernard

(1)Fredericton, New Brunswick, Canada

For any type of data processing, files are absolutely necessary. It very quickly becomes the case that there is too much information to have the user input it manually. You need to be able to handle importing information directly from files of various types.

This chapter, you will look at the most common tasks you need to be able to handle in order to read and write files. You’ll also look at how to deal with other forms of input and output.

4-1. Copying Files

Problem

You need to copy files from one location to another.

Solution

There are two functions from the shutil module that can be used to copy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required