Create a macro to generate a print variable?
Hi!
I'm wondering if it is possible to create a macro that generates a specific print for a variable, e.g. if you select a variable stuffs, it then generates a print("stuffs -> ", stuffs). Or similar. Have tried to explore the macros, but it repeats exactly the same thing... Does anyone know how to do this?
Thanks!
Please sign in to leave a comment.
You can achieve that using Live Templates: https://www.jetbrains.com/help/pycharm/using-live-templates.html#
That's awesome! Thanks. Almost managed to do what I wanted! Do you know if there is any way allow it to leave the line with the selected variable alone and add code below?
E.g.
stuffs = ....
select stuffs -> ctrl + alt + T -> template, which produces
stuffs = ....
print("stuffs...