Auto complete if __name__ == "__main__":

Completed

How can I set pycharm up such that when I start typing if __name__... it auto generates the rest of the line? 

Secondly, and not related to pycharm, what is this line called? I know the purpose of it, but I dont know how to express it without describing aloud something like this: "the `if name = main` line". haha

1
1 comment
Avatar
Permanently deleted user

You can use live templates as in this video tutorial. This quick answer is to use command+j (Mac) or ctrl+j (Windows) to bring up the live templates list, then then type "m" to search for the shortcut to __name__=='__main__', then hit enter.

7

Please sign in to leave a comment.