Creating folders based on names in a text file in python
<p>I am trying to get a python script to read a text file that has a list of names in it and create folders based on those names. For example, if the text file has "john_doe" and "jane_doe" in it, the script should create two folders. One called "john_doe" and one called "jane_doe". </p>

<p>When I run my script, I get the error WindowsError: [Error 123] The filename, directory name, or colume label syntax is incorrect: ",open file 'names.txt', mode 'r' at 0X00000000025E6300>"</p>

<p>Here's the script that I'm running:</p>

<pre><code>import os

with open('names.txt') as x:
    for line in x:
        line = line.strip()
        os.mkdir(str(x))
</code></pre>

<p>I think that it's more of a Windows problem (hence the WindowsError), but I'm not sure how to get around it. Any tips?</p>