Error opening a file with date/time stamp in its name
<p>I want to create a file with date and time stamp appended to the file name using Python. When I am doing this, I am getting the error while opening the file.</p>

<pre><code>today = datetime.datetime.today().strftime("%m-%d-%Y_%H:%M:%S")
file = "text" + today
open(file,'w')
</code></pre>

<p>It reports error for invalid file name.</p>
