You open the variable “file” as a read only then attempt to write to it:
file = open('ValidEmails.txt','r')
Instead, use the ‘w’ flag.
file = open('ValidEmails.txt','w')
...
file.write(email)
More Related Contents:
- Is there a way to ordinate numbers in a list?
- Code to calculate file compression on python [closed]
- Get raw key value
- Download file from web in Python 3
- “:=” syntax and assignment expressions: what and why?
- Extracting text from a PDF file using PDFMiner in python?
- How to convert ‘binary string’ to normal string in Python3?
- How to get the latest file in a folder?
- Python, HTTPS GET with basic authentication
- Conditionally fill column values based on another columns value in pandas
- Python – TypeError: ‘int’ object is not iterable
- How can I get 2.x-like sorting behaviour in Python 3.x?
- How to redirect with post data (Django)
- Powersets in Python using itertools
- How to make a custom object iterable?
- Basemap import error in PyCharm — KeyError: ‘PROJ_LIB’
- Installed module using pip, not found
- How to use IFileOperation from ctypes
- How to test Python 3.4 asyncio code?
- Getting value of enum on string conversion
- How to run different python versions in cmd [duplicate]
- cx_Oracle error. DPI-1047: Cannot locate a 64-bit Oracle Client library
- Discord.py error: TypeError: __new__() got an unexpected keyword argument ‘deny_new’
- How to strip all whitespace from string
- How to enable Pan and Zoom in a QGraphicsView
- Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]
- Python dictionary replace values
- TypeError: attack() missing 1 required positional argument: ‘self’
- Same name for classmethod and instancemethod
- How to calculate length of string in pixels for specific font and size?