AttributeError: 'NoneType' object has no attribute 'read' in python
<pre><code>if __name__ == '__main__':
    filename = open('sevi.txt', 'wb')
    content = filename.write("Cats are smarter than dogs")
    for line in content.read(): 
        match = re.findall('[A-Z]+', line)
        print match
    filename.close()
</code></pre>

<p>I am new to python. I am just opening a file and writing some text into it. Later reading the content find all the characters in it by using regular expression.  but I am getting the error as 'NoneType' object has no attribute 'read'. if I use readlines also, I am getting the error.</p>