how to execute Python 3.3 script in Spyder console with variables?

前端 未结 2 951
太阳男子
太阳男子 2020-12-16 13:27

how can I execute Python 3.3 script in Spyder console, and that has variables?

My sample code (C:/test/myfile.py) is

from sys import argv
script, fir         


        
相关标签:
2条回答
  • 2020-12-16 13:36

    What also works is the IPython console of Spyder is:

    In [1]: runfile('C:/yourfolder/myfile.py',args='one two three')

    0 讨论(0)
  • 2020-12-16 13:50

    You need to go

    Run > Configuration per file

    (or hit Ctrl+F6) and in the dialog that it appears you need to check

    Command line options

    and write (for example) there

    1 2 3

    After closing this dialog and hitting F5, you'll see the output you are expecting.

    Note: Please remember that these command line options are saved between Spyder restarts as part of the file run config, so if you want to change them, you need to hit Ctrl+F6 again.

    0 讨论(0)
提交回复
热议问题