title: I'm trying to use dictionary as an underlying data structure to create a simple file system. But I'm running into issues with accessing keys
body: <p>The main idea is that when we make a directory and we call ls on a directory it should return whatever it's in b. However, I'm running into the issue that my code goes into the if statement meaning it knows there is a key in the defaultdict that matches our key(b) but it still returns None.</p>
  <p>I'm not sure why and I would appreciate it if anyone can tell me what is wrong with my code.
  Here is the command I ran:</p>
  <pre><code>fileSystem = FileSystem()
  fileSystem.mkdir(&quot;/a/b/c&quot;)
  fileSystem.ls(&quot;/a/b&quot;);
  </code></pre>
  <p>This should output ['c'] but rather my code is returning None</p>
  <pre><code>from collections import defaultdict
  class FileSystem(object):
      def __init__(self):
          self.file_system = defaultdict(list)
          self.saveData = dict()
          self.currentPath = []
      def ls(self, path):
          split_path = path.split('/')
          dest = split_path[-1]
          if dest in self.file_system.keys():
              return self.file_system.get(dest).sort()
          else:
              return self.currentPath
              
                  
      
      def mkdir(self, path):
          split_path = path.split('/')
          parent = split_path[1]
          self.file_system[split_path[1]].append(split_path[1])
          self.currentPath.append(split_path[1])
          for folder in split_path[2:]:
              self.file_system[parent].append(folder)
              self.saveData[folder] = None
              parent = folder
      
      def addContentToFile(self, filePath, content):
          split_path = filePath.split('/')
          dest = split_path[-1]
          if dest in self.saveData.keys():
              history = self.saveData[dest]
              self.saveData[dest] = history + content
          else:
              self.saveData[dest] = content
      
      def readContentFromFile(self, filePath):
          split_path = filePath.split('/')
          dest = split_path[-1]
          if dest in self.saveData:
              return self.saveData[dest]
              
  fileSystem = FileSystem()
  fileSystem.mkdir(&quot;/a/b/c&quot;)
  fileSystem.ls(&quot;/a/b&quot;);
  </code></pre>