The output file needs to be opened in binary mode:
f = open('varstor.txt','w')
needs to be:
f = open('varstor.txt','wb')
More Related Contents:
- Saving and loading multiple objects in pickle file?
- Unpickling a python 2 object with python 3
- Pickle incompatibility of numpy arrays between Python 2 and 3
- Python 3 – Can pickle handle byte objects larger than 4GB?
- How to open a file within python?
- A simple maths operation on a CSV column using python [closed]
- Why am getting an "elif" syntax error showing invalid syntax in python [closed]
- How can I connect to MySQL in Python 3 on Windows?
- best way to preserve numpy arrays on disk
- Image library for Python 3
- The fastest way to read input in Python
- Why np.hypot and np.subtract.outer very fast compared to vanilla broadcast ? Using Numba for speedup numpy in parallel for distance matrix calculation
- matplotlib: plot multiple columns of pandas data frame on the bar chart
- How to prevent BrokenPipeError when doing a flush in Python?
- ImportError on python 3, worked fine on python 2.7
- How can I use psycopg2.extras in sqlalchemy?
- Combine awaitables like Promise.all
- Python range() and zip() object type
- Updating a dictionary in python
- What does *tuple and **dict mean in Python? [duplicate]
- pip throws TypeError: parse() got an unexpected keyword argument ‘transport_encoding’ when trying to install new packages
- Why does Python installed via Homebrew not include Tkinter
- How do I install Python in Google Cloud Shell?
- PyQt Class not working for the second usage
- How to use sys.exit() in Python
- Is there a way to use asyncio.Queue in multiple threads?
- match dates using python regular expressions
- How to get value of variable entered from user input?
- Add custom form fields that are not part of the model (Django)
- Writing to a new file if it doesn’t exist, and appending to a file if it does