How to restart a .py file when it finishes [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am creating a simple game that will have the character die a lot, and as a consequence will end the game. how can i make it to have something like pressing the space bar restarts the file or something along those lines? It's a very simple file, so i am just looking for a simple solution.

You could wrap your script in a
while True:
...
block, or with a bash script:
while true ; do
yourpythonscript.py

Related

Problem wih virtual keyboard not write in correct please [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I tryvto make virtual keyboard
It work But the problem is when I try to write with it
It's right hereenter image description here
What I actually want is to wrte In real desktop program like word ,note and so on
Please tell me if you want the code
Oh how can I fix it

How do I duplicate the same window in VSCODE [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
I tried duplicating a the same window but it just went. I made this server.py file that needs to be run twice if we need 2 players. Anyone know how to duplicate windows in vscode?
You could open up a new terminal window with cntrl + shift + backtick, and run your python server there (probably on a different port).

How to run a function after another function is done in python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I just learned python the other day, I was wondering how I can make the function vc_s2() wait for function vc_s1() to be done before running, and the same for vc_s3() with vc_s2()?
Thank you so much in advance!
from funtions import vc_s1, vc_s2, vc_s3
vc_s1()
vc_s2()
vc_s3()
Python runs chronologically, so it goes from top to bottom, as long as you have the 3 functions in order you should be fine.

Pdb doesn't stop in a break point [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am using Pdb the debugger of Python.
when I set a breakpoint in my callback, the Pdb doesn't stop there.
I used :
continue
Use import pdb; pdb.set_trace() if you want to specify in your source code that the debugger should be invoked at that point.

How to program python to auto stop a long output [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
So I am creating a python script that I want to make it run in a loop that outputs numbers but how do I make python stop itself?
Basically my question is how do I make python use Ctrl+C or something else and stop itself?
If this is what you're saying, here is an example:
while True:
#do your number things here
if the_number == some_amount:
break
You use the break command when you reach a certain condition to break out of a while or for loop.
Hopefully this is what you wanted. If you have questions, ask away in the comments.
You can try sending the Control-C signal through os.kill().
http://docs.python.org/2/library/os.html
This is for sending the Control C singal to the process and not for ending a loop (Remolten's Solution).

Categories

Resources