Python - Vover a llamar al Bucle For

 
Vista:

Vover a llamar al Bucle For

Publicado por Alberto (1 intervención) el 30/01/2023 17:21:33
Hola Alguien me puede ayudar ? como puedo crear una funcion para que vuelva a ejecutar el codigo otra vez


Gracias antes de nada!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import psutil
 
def checkIfProcessRunning(processName):
    '''
    Check if there is any running process that contains the given name processName.
    '''
    #Iterate over the all the running process
    for proc in psutil.process_iter():
        try:
            # Check if process name contains the given name string.
            if processName.lower() in proc.name().lower():
                return True
        except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
            pass
    return False;
 
i = 0
//aqui tendria que ir el nombre de la funcion !
 
for i in range(800):
 else:
 
  if checkIfProcessRunning('serverminecraft'):
    print('server sigue corriendo')
    i = 0
    print('Lo hizo!')
 
  else:
    print('server no sigue corriendo')
    //aqui tendria que ir la llamada ala funcion
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder