<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 常見問題 本節列出常見的一些問題。 ### 如何獲取當前路徑 當前路徑可以用`'.'`表示,再用`os.path.abspath()`將其轉換為絕對路徑: ~~~ # -*- coding:utf-8 -*- # test.py import os print(os.path.abspath('.')) ~~~ 運行結果: ~~~ $ python3 test.py /Users/michael/workspace/testing ~~~ ### 如何獲取當前模塊的文件名 可以通過特殊變量`__file__`獲取: ~~~ # -*- coding:utf-8 -*- # test.py print(__file__) ~~~ 輸出: ~~~ $ python3 test.py test.py ~~~ ### 如何獲取命令行參數 可以通過`sys`模塊的`argv`獲取: ~~~ # -*- coding:utf-8 -*- # test.py import sys print(sys.argv) ~~~ 輸出: ~~~ $ python3 test.py -a -s "Hello world" ['test.py', '-a', '-s', 'Hello world'] ~~~ `argv`的第一個元素永遠是命令行執行的`.py`文件名。 ### 如何獲取當前Python命令的可執行文件路徑 `sys`模塊的`executable`變量就是Python命令可執行文件的路徑: ~~~ # -*- coding:utf-8 -*- # test.py import sys print(sys.executable) ~~~ 在Mac下的結果: ~~~ $ python3 test.py /usr/local/opt/python3/bin/python3.4 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看