Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MASTERING PYCHARM

You're reading from   MASTERING PYCHARM Use PyCharm with fluid efficiency to write idiomatic python code

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781783551316
Length 232 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nafiul Islam Nafiul Islam
Author Profile Icon Nafiul Islam
Nafiul Islam
Arrow right icon
View More author details
Toc

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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime