import script2 # just call it like any other function script2.somefunction("ice-cream!")
# This is hatprinter.py script, it just prints the type of hat # passed in, argv[1] will be the type of hat. import sys def main(): """ Do more magical things """ print sys.argv # i use argv[1] as a hat. my_hat = argv[1] # yay hats print my_hat def __name__ == "__main__": main()
python hatprinter.py "ITS A HAT!"
import sys import script2 def main(): """ Do stuff """ # do something with this scripts arguments if needed # .... # to call the second scripts sys.argv = [script2.__file__, "ITS A HAT"] script2.main() if __name__ == "__main__": main()
import os os.system("""python script2.py "ITS A HAT"""") # or a better way import subprocess subprocess.Popen(["python", "script2.py", "ITS A HAT"])
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.