First, how when you create a .py file, so that the contents of the file is automatically populated write custom?
File ---> Settings ---> Editor ---> Code Style ---> File and Code Templates, select Python Script, the customized content can be written.
Also supports other HTML, XML, XHTML and other documents automatically add comments.
Figure: