Book Image

Mastering PyCharm

By : Nafiul Islam
Book Image

Mastering PyCharm

By: Nafiul Islam

Overview of this book

Table of Contents (18 chapters)
Mastering PyCharm
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

File templates


Let's make a new file in PyCharm. The two options that you have, Python file and Python unit test, are file templates. You might have more than what is shown here, but in essence, when you make a new file template, it shows up as an option when you make a new file. So, let's take a look at what's inside these two templates:

Understanding variables

As you can see in the template (in the preceding screenshot) there is some code to initiate the file. In this case, it's Python Unit Test. You can also see that (indicated by a red arrow); there are some special variables that you can use inside the template. The file templating engine PyCharm uses is called Velocity Template Language (VTL).

Some of the variables are given to you by default. So, $USER is derived from the username that the user has registered to PyCharm with. If you registered with an abbreviation of your name, you might want to change the $USER variable, and you can do it like this:

#set ( $USER = "THE AMAZING SPIDER...