Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
121 views
in Technique[技术] by (71.8m points)

python - How to run different files without manually changing the configuration?

I'm using Pycharm and I have an issue. I can't just click run and run files on their own, if they are in a project file. I can, but I need to keep changing and deleting the 'configurations' at the top right every time I switch files. It keeps creating new configurations every time I open a new file, which is why I changed the default value of 5 to 1. I did this so I don't have to keep deleting it, but I still have to change it every time I switch files and want to run that file. It's pretty annoying, is there anyway to just run the files like normal without having to change the configurations?

image 1

image 2

image 3

question from:https://stackoverflow.com/questions/65868852/how-to-run-different-files-without-manually-changing-the-configuration

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Collecting comments to an answer:


Running a file need a configuration, which means how to run that file.

It's just not so necessary to worry about them and deal with them, using one of these ways:

  • Right-click the mouse anywhere inside the file view and press Run <filename>

  • ctrl+shift+F10 on windows

  • Use a main guard and Pycharm will add a small green arrow through which you can run the file directly:

    enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...