© Joannah Nanjekye 2017
Joannah NanjekyePython 2 and 3 Compatibilityhttps://doi.org/10.1007/978-1-4842-2955-2_8

8. Working with Files

Joannah Nanjekye
(1)
Kampala, Uganda
 
Every operating system makes use of files as the primary storage mechanism, and as such, there are mechanisms that allow us open and read from these files. Python also provides methods for opening, reading, and writing from files, but there are significant differences regarding how Python 2 and 3 handles file processing. This chapter explains the differences and shows neutral ways of performing file processing for compatibility on both versions using the io.open method.

File Processing

Before we look at compatibility in files, I will chitchat a bit about general file processing. ...

Get Python 2 and 3 Compatibility: With Six and Python-Future Libraries now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.