• <bdo id='GAHMh'></bdo><ul id='GAHMh'></ul>
    <tfoot id='GAHMh'></tfoot>
    <i id='GAHMh'><tr id='GAHMh'><dt id='GAHMh'><q id='GAHMh'><span id='GAHMh'><b id='GAHMh'><form id='GAHMh'><ins id='GAHMh'></ins><ul id='GAHMh'></ul><sub id='GAHMh'></sub></form><legend id='GAHMh'></legend><bdo id='GAHMh'><pre id='GAHMh'><center id='GAHMh'></center></pre></bdo></b><th id='GAHMh'></th></span></q></dt></tr></i><div id='GAHMh'><tfoot id='GAHMh'></tfoot><dl id='GAHMh'><fieldset id='GAHMh'></fieldset></dl></div>
  • <legend id='GAHMh'><style id='GAHMh'><dir id='GAHMh'><q id='GAHMh'></q></dir></style></legend>

    <small id='GAHMh'></small><noframes id='GAHMh'>

        os.getenv 和 os.environ.get 的区别

        Difference between os.getenv and os.environ.get(os.getenv 和 os.environ.get 的区别)

        <tfoot id='hIhe8'></tfoot>
      1. <small id='hIhe8'></small><noframes id='hIhe8'>

            <bdo id='hIhe8'></bdo><ul id='hIhe8'></ul>

            <legend id='hIhe8'><style id='hIhe8'><dir id='hIhe8'><q id='hIhe8'></q></dir></style></legend>
                <tbody id='hIhe8'></tbody>

                  <i id='hIhe8'><tr id='hIhe8'><dt id='hIhe8'><q id='hIhe8'><span id='hIhe8'><b id='hIhe8'><form id='hIhe8'><ins id='hIhe8'></ins><ul id='hIhe8'></ul><sub id='hIhe8'></sub></form><legend id='hIhe8'></legend><bdo id='hIhe8'><pre id='hIhe8'><center id='hIhe8'></center></pre></bdo></b><th id='hIhe8'></th></span></q></dt></tr></i><div id='hIhe8'><tfoot id='hIhe8'></tfoot><dl id='hIhe8'><fieldset id='hIhe8'></fieldset></dl></div>
                  本文介绍了os.getenv 和 os.environ.get 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这两种方法有什么区别吗?

                  Is there any difference at all between both approaches?

                  >>> os.getenv('TERM')
                  'xterm'
                  >>> os.environ.get('TERM')
                  'xterm'
                  
                  >>> os.getenv('FOOBAR', "not found") == "not found"
                  True
                  >>> os.environ.get('FOOBAR', "not found") == "not found"
                  True
                  

                  它们似乎具有完全相同的功能.

                  They seem to have the exact same functionality.

                  推荐答案

                  参见 此相关线程.基本上,os.environ 是在导入时找到的,而 os.getenvos.environ.get 的包装器,至少在 CPython 中是这样.

                  See this related thread. Basically, os.environ is found on import, and os.getenv is a wrapper to os.environ.get, at least in CPython.

                  为了回复评论,在 CPython 中,os.getenv 基本上是 os.environ.get 的快捷方式;因为 os.environ 是在 os 的导入时加载的,只有这样,同样适用于os.getenv.

                  To respond to a comment, in CPython, os.getenv is basically a shortcut to os.environ.get ; since os.environ is loaded at import of os, and only then, the same holds for os.getenv.

                  这篇关于os.getenv 和 os.environ.get 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                      <bdo id='LI34D'></bdo><ul id='LI34D'></ul>
                    • <i id='LI34D'><tr id='LI34D'><dt id='LI34D'><q id='LI34D'><span id='LI34D'><b id='LI34D'><form id='LI34D'><ins id='LI34D'></ins><ul id='LI34D'></ul><sub id='LI34D'></sub></form><legend id='LI34D'></legend><bdo id='LI34D'><pre id='LI34D'><center id='LI34D'></center></pre></bdo></b><th id='LI34D'></th></span></q></dt></tr></i><div id='LI34D'><tfoot id='LI34D'></tfoot><dl id='LI34D'><fieldset id='LI34D'></fieldset></dl></div>

                          <tfoot id='LI34D'></tfoot>

                            <small id='LI34D'></small><noframes id='LI34D'>

                              <tbody id='LI34D'></tbody>
                            <legend id='LI34D'><style id='LI34D'><dir id='LI34D'><q id='LI34D'></q></dir></style></legend>