Skip to content Skip to sidebar Skip to footer

Python Interaction With The Output Using A Script

I have a python script 'Script1.py' that I do not change the inside of. I want to interact with its output using another script(.py or .bat). The script 'Script1.py' gives a lot of

Solution 1:

Put the code inside a function and call it with an import. Also, you can use if __name__ == '__main__' to execute the module as an script.

def function_generic_name(arg1,arg2):
    **code**
    return something

if __name__ == '__main__':
    function_generic_name(arg1,arg2)

Post a Comment for "Python Interaction With The Output Using A Script"