codecs open('unidata txt'encoding='utf 'read( 'sp\xc mopen('unidata txt''rb'read('sp\xc \ mopen('unidata txt'read('sp\xc \ xread/decode text xread raw bytes xraw/undecoded too although you won' generally need to care about this distinction if you deal only with ascii textpython' strings and files are an asset if you deal with either binary data (which includes most types of mediaor text in internationalized character sets (which includes most content on the web and internet at large todaypython also supports non-ascii file names (not just content)but it' largely automatictools such as walkers and listers offer more control when neededthough we'll defer further details until other file-like tools the open function is the workhorse for most file processing you will do in python for more advanced tasksthoughpython comes with additional file-like toolspipesfifossocketskeyed-access filespersistent object shelvesdescriptor-based filesrelational and object-oriented database interfacesand more descriptor filesfor instancesupport file locking and other low-level toolsand sockets provide an interface for networking and interprocess communication we won' cover many of these topics in this bookbut you'll find them useful once you start programming python in earnest other core types beyond the core types we've seen so farthere are others that may or may not qualify for membership in the categorydepending on how broadly it is defined setsfor exampleare recent addition to the language that are neither mappings nor sequencesratherthey are unordered collections of unique and immutable objects you create sets by calling the built-in set function or using new set literals and expressions in and and they support the usual mathematical set operations (the choice of new syntax for set literals makes sensesince sets are much like the keys of valueless dictionary) set('spam' {' '' '' 'make set out of sequence in and make set with set literals in and xy tuple of two sets without parentheses ({' '' '' '' '}{' '' '' '} {' '' ' {' '' '' '' '' ' introducing python object types intersection union difference