title: Using pathlib in Google Colab: AttributeError: ‘PosixPath’ object has no attribute ‘ls’
body: <p>If I run the following code:</p>
  
  <pre><code>from pathlib import Path
  path = Path('data/mnist')
  path.ls()
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>AttributeError: ‘PosixPath’ object has no attribute ‘ls’
  </code></pre>
  
  <p>Looking at the Path class in pathlib, I find:</p>
  
  <pre><code>def __new__(cls, *args, **kwargs):
          if cls is Path:
              cls = WindowsPath if os.name == 'nt' else PosixPath
          self = cls._from_parts(args, init=False)
          if not self._flavour.is_supported:
              raise NotImplementedError("cannot instantiate %r on your system"
                                        % (cls.__name__,))
          self._init()
          return self
  </code></pre>
  
  <p>I'm guessing this means it will run PosixPath instead, which is:</p>
  
  <pre><code>class PosixPath(Path, PurePosixPath):
      """Path subclass for non-Windows systems.
  
      On a POSIX system, instantiating a Path should return this object.
      """
      __slots__ = ()
  </code></pre>
  
  <p>Not too sure what this means.</p>
  
  <p>And actually, I can't find Path.ls() at all in the pathlib source code. Does this make sense? The coding tutorial I'm following used it (on a windows machine).</p>