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!

Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

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

Webcam streaming throught VLC with YUY2 compatibility