title: expected str, bytes or os.PathLike object, not list ( want to get file names from list)
body: <p>I'm trying to get only the file name without extension, what I still get this error even though it's what it says in the book I'm trying to read.</p>
  <pre><code>import os
  import re
  stringA =[fname.rsplit(' ',0)[0] for fname in os.listdir(&quot;C:\\Users\\Desktop\\New folder\\New folder\\&quot;)]
  stringA1 = os.path.splitext(os.path.basename(stringA))[0]
  </code></pre>
  <p>I get this error:</p>
  <pre><code>~\Anaconda3\lib\ntpath.py in basename(p) 
      214 def basename(p): 
      215 &quot;&quot;&quot;Returns the final component of a pathname&quot;&quot;&quot; 
  --&gt; 216 return split(p)[1] 
      217 
      218 
  ~\Anaconda3\lib\ntpath.py in split(p) 
      183 Return tuple (head, tail) where tail is everything after the final slash. 
      184 Either part may be empty.&quot;&quot;&quot; 
  --&gt; 185 p = os.fspath(p) 
      186 seps = _get_bothseps(p) 
      187 d, p = splitdrive(p) 
  TypeError: expected str, bytes or os.PathLike object, not list
  </code></pre>