Nauč se Python > Materiály > Snake Workshop for PyLadies > Preparation > Editor installation > Notepad++

Installation of Notepad++ #

Notepad++ is only available for Windows.

Download it from its homepage and install it.

Setup #

Indentation

In the Settings menu, choose Options, then Syntax, and then set "Tab Settings" to "Replace by Space".

The syntax highlighting will work automatically in files with the extension .py (like Python). In other programming languages, indenting and syntax highlighting works differently.

Therefore, as soon as you create a new file in this editor, you should save it under the correct name as soon as possible.

Indentation practice #

As already mentioned, in Python it is important how many spaces a line starts with. Therefore, it will be useful for us to know how to quickly indent blocks of text. Let's see how to do it.

Copy this text into the editor:

OPHELIA:
Good my lord,
How does your honour for this many a day?
HAMLET:
I humbly thank you; well, well, well.
OPHELIA:
My lord, I have remembrances of yours
That I have longed long to re-deliver.
I pray you, now receive them.
HAMLET:
No, not I.
I never gave you aught.
OPHELIA:
My honour’d lord, you know right well you did,
And with them words of so sweet breath compos’d
As made the things more rich; their perfume lost,
Take these again; for to the noble mind
Rich gifts wax poor when givers prove unkind.
There, my lord.

(An excerpt from Hamlet by W. Shakespeare)

This text is not very clear, so we will try to space it out to make it look like this:

OPHELIA:
    Good my lord,
    How does your honour for this many a day?
HAMLET:
    I humbly thank you; well, well, well.
OPHELIA:
    My lord, I have remembrances of yours
    That I have longed long to re-deliver.
    I pray you, now receive them.
HAMLET:
    No, not I.
    I never gave you aught.
OPHELIA:
    My honour’d lord, you know right well you did,
    And with them words of so sweet breath compos’d
    As made the things more rich; their perfume lost,
    Take these again; for to the noble mind
    Rich gifts wax poor when givers prove unkind.
    There, my lord.

To indent one line, set the cursor at the beginning of the line and press the Tab key. Each time you press it, the line will be indented by 4 spaces.

If you indent too much, you can reduce the indentation using Shift+Tab.

If you want to indent multiple lines at once, select them all and press Tab. You can also "unindent" the whole selection using Shift+Tab.

And that's it! Now you not only have the editor set up, but you also know how to use it.


Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.