Run Process Hidden Python

后端 未结 2 1738
醉酒成梦
醉酒成梦 2021-01-29 03:18

I am new in python and I making a new code and I need a little help

Main file :

import os
import time
import sys
import app
import dbg
import dbg
import         


        
2条回答
  •  [愿得一人]
    2021-01-29 03:53

    Why not doing this: define a method in the module you import and call this method 5 times in a loop with a certain time.sleep(x) in each iteration.

    Edit:

    Consider this is your module to import (e.g. very_good_module.py):

    def interesting_action():
        print "Wow, I did not expect this! This is a very good module."
    

    Now your main module:

    import time
    import very_good_module
    
    [...your code...]
    
    if __name__ == "__main__":
        while True:
            very_good_module.interesting_action()
            time.sleep(5)
    

提交回复
热议问题