title: Generate output as list instead of multiple lines
body: <p>I want to display the files and folders inside a directory in a specific format.</p>
  <p>The folder looks like this:</p>
  <pre><code>/home/test_directory
      fg-2022-07-12
      fg-2022-07-11
      ag-2022-07-12
  </code></pre>
  <p>My code to display certain elements of the folder:</p>
  <pre><code>SRC = '/home/test_directory'
  
  for root_dir_path, sub_dirs, files in os.walk(SRC):
      for folders in sub_dirs:
          if &quot;fg-&quot; in folders:
              print(folders)
  </code></pre>
  <p>Current output:</p>
  <pre><code>fg-2022-07-08
  fg-2022-07-07
  </code></pre>
  <p>Desired output:</p>
  <pre><code>['fg-2022-07-08', 'fg-2022-07-07']
  </code></pre>
  <p>Preferably, I would like to generate the list <strong>instead</strong> of the multiple lines, but converting the multiple lines (current output) into a list would work too</p>