python download images are not saved to the correct directory
<p>When i use python 2.7 to download images from a website, the code as follows:</p>

<pre><code>pic = requests.get(src[0])
f = open("pic\\"+str(i) + '.jpg', "wb")
f.write(pic.content)
f.close()
i += 1
</code></pre>

<p>I want to save the picture into pic directory, but I find that images is saved in the same directory with the name like <code>pic\1.jpg</code>. Is this a bug?</p>

<p>In Windows, it's right, but on Ubuntu, it's an error!</p>

<pre><code>import os
f = open(os.sep.join(['pic', str(i), '.jpg']), 'wb')
</code></pre>

<p>Now the line should be os agnostic</p>

python file