How to write a file code template in Pycharm

To add utf-8 compatibility in all your scripts, one solution is enable a template that add this compatibility and other information as copyright, your name, etc.
File and code templates are written in the Velocity Template Language (VTL). So you may include variables as ${YEAR}, ${USER}, etc.
To add code to your scritps go to File/Settings.../Editor/File and Code Templates
Select Python Script and add the following lines:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) ${YEAR} ${USER}

Now, if you create a new Python file, it will generate with this header code by default.
If you want more VTL variables please go here
Enjoy it!


Popular posts from this blog

How to fix Android when developer options are not available for this user

from: can't read /var/mail/ in Python scripts

How to fix VirtualBox error when you try to import an ova file