N
N
Nikolay Karlov2019-07-24 05:25:16
IDE
Nikolay Karlov, 2019-07-24 05:25:16

How to enter several characters (actions) with one keyboard button?

I am a beginner pythonist. I want to make my life easier.
Let's say I want to enter a string literal or output to the console. I usually do it like this:
I write print(""), then I put the cursor between the quotes and enter the text.
It seems to me that writing code would become more convenient for me if on the keyboard it would be possible to reassign some keys to a certain sequence of actions. For example, I typed print, pressed F9, and the system itself would type (""), and then moved the cursor 2 times to the left.
Or, for example, after assigning "=" I have some expression, and I understand that I need to enclose it in brackets in order to pass it to another function. That is, it was func1(arg), but I want to do func2(func1(arg)). To do this, put brackets to the left and right of the first expression. I would like to simplify this as well, for example, using the F10 key to simulate the input "(", then "End", then ")".
System - Windows.
The closest I found is the Key Remapper program, but it only allows you to set up 2 actions - to press and release the button. You need at least 3.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serezha, 2019-07-24
Ahen @Ahen

We take an IDE, I don’t know which one is the best in python.
Create a code template, use.
For example, for jetbrains https://habr.com/en/post/414813/
They also have an ide for python.
Well, yes, I think that for most everyday tasks, the built-in templates are enough, when you start typing a line and the environment prompts you to select a template, often the one you need will be at the very top, so we type three letters, press enter and you're done.
Automatic creation of brackets and other pluses are present. As for moving the cursor between brackets or in quotation marks - look at the features and possibilities, point one, in the article at the link above.
Working in ide at the level of muscle memory, you remember what code it can automatically generate and spend much less time on the routine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question