Refresher notes on python syntax
These are used to handle errors etc
the codecs module defines classes for python codecs. This handles errors and encoding and decoding lookup process.
codecs.open(filename, mode='r', encoding=None, errors='strict, buffering=-1)
- This will oepn a file in read only
- setting encoding to none will allow it to accept any type of encoding
- errors set to strict will raise a ValueError when an encoding error occurs
- buffering set to -1 is the default, this just means that the default buffer will be used
with codecs.open('data/templates/blogfeed.html', 'w', 'utf8') as f:
f.write(html)
- This code snippit taken from
magfeed.pyandblogfeed.pywill open the specified file and write everything in thehtmlvariable to it.