打开带有标志的Python IDLE

2024-03-29 13:24:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在学习麻省理工学院的开放式课程“电气工程与计算机科学导论1”,并且正在学习信号课程的模块。在

我在课堂上使用绘图方法有困难。课程材料说明:

如果要从idle内部绘制信号图,请确保以-n标志启动idle

这是我第一次在我的教育中遇到的标志。我想我已经理解了它的基本要点,并尝试过使用windows命令提示符打开IDLE。在

然而,到目前为止,我一直没有运气,尽管我的猜测并不真正知道我在做什么。在

有人能解释一下我是如何做到这一点的吗?更一般地说,打开带有标志的程序是如何工作的?在

我做过一些google/stack搜索,但是只得到了一些堆栈溢出的材料,假设我在回答其他问题或在python中编写函数时讨论标志的信息(myFlag=False或其他任何东西)。在

我使用的是python2.6。在

提前致谢。抱歉,如果问题是愚蠢的或明显的,我是相当新的编码。在


Tags: 模块方法绘图信号标志windows绘制课程
1条回答
网友
1楼 · 发布于 2024-03-29 13:24:01

idle只是操作系统运行的另一个程序。就像grep或ls可以有标志,所以可以空闲。标志只会使解析命令行上的参数更容易、更高效。在macos上有hre选项。窗口将类似

└─╼ idle -h

USAGE: idle  [-deins] [-t title] [file]*
       idle  [-dns] [-t title] (-c cmd | -r file) [arg]*
       idle  [-dns] [-t title] - [arg]*

  -h         print this help message and exit
  -n         run IDLE without a subprocess (see Help/IDLE Help for details)

The following options will override the IDLE 'settings' configuration:

  -e         open an edit window
  -i         open a shell window

The following options imply -i and will open a shell:

  -c cmd     run the command in a shell, or
  -r file    run script from file

  -d         enable the debugger
  -s         run $IDLESTARTUP or $PYTHONSTARTUP before anything else
  -t title   set title of shell window

A default edit window will be bypassed when -c, -r, or - are used.

[arg]* are passed to the command (-c) or script (-r) in sys.argv[1:].

Examples:

idle
        Open an edit window or shell depending on IDLE's configuration.

idle foo.py foobar.py
        Edit the files, also open a shell if configured to start with shell.

idle -est "Baz" foo.py
        Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell
        window with the title "Baz".

idle -c "import sys; print sys.argv" "foo"
        Open a shell window and run the command, passing "-c" in sys.argv[0]
        and "foo" in sys.argv[1].

idle -d -s -r foo.py "Hello World"
        Open a shell window, run a startup script, enable the debugger, and
        run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in
        sys.argv[1].

echo "import sys; print sys.argv" | idle - "foobar"
        Open a shell window, run the script piped in, passing '' in sys.argv[0]
        and "foobar" in sys.argv[1].

相关问题 更多 >