<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        Python內置函數locals

        來源:懂視網 責編:小采 時間:2020-11-27 14:28:04
        文檔

        Python內置函數locals

        Python內置函數locals:英文文檔:locals()Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in
        推薦度:
        導讀Python內置函數locals:英文文檔:locals()Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in

        英文文檔:

        locals()

        Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in class blocks.

        說明:

          1. 函數功能返回當前作用域內的局部變量和其值組成的字典,與globals函數類似(返回全局變量)

        >>> locals()
        {'__package__': None, '__loader__': , '__doc__': None, '__name__': '__main__', '__builtins__': , '__spec__': None}
        
        >>> a = 1
        
        >>> locals() # 多了一個key為a值為1的項
        {'__package__': None, '__loader__': , 'a': 1, '__doc__': None, '__name__': '__main__', '__builtins__': , '__spec__': None}

          2. 可用于函數內。

        >>> def f():
         print('before define a ')
         print(locals()) #作用域內無變量
         a = 1
         print('after define a')
         print(locals()) #作用域內有一個a變量,值為1
        
         
        >>> f
        
        >>> f()
        before define a 
        {} 
        after define a
        {'a': 1}

         3. 返回的字典集合不能修改。

        >>> def f():
         print('before define a ')
         print(locals()) # 作用域內無變量
         a = 1
         print('after define a')
         print(locals()) # 作用域內有一個a變量,值為1
         b = locals()
         print('b["a"]: ',b['a']) 
         b['a'] = 2 # 修改b['a']值
         print('change locals value')
         print('b["a"]: ',b['a'])
         print('a is ',a) # a的值未變
        
         
        >>> f()
        before define a 
        {}
        after define a
        {'a': 1}
        b["a"]: 1
        change locals value
        b["a"]: 2
        a is 1
        >>>

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        Python內置函數locals

        Python內置函數locals:英文文檔:locals()Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 日本在线观看免费高清| 亚洲国产精品无码久久98| 人妻免费一区二区三区最新| 久久夜色精品国产亚洲av| 成人一级免费视频| 亚洲狠狠婷婷综合久久久久| 国产黄色免费观看| 亚洲精品无码永久中文字幕| 国产成人无码区免费内射一片色欲 | 亚洲色中文字幕无码AV| 成在人线av无码免费高潮喷水| 亚洲成AV人片在线观看| 99视频在线看观免费| 亚洲午夜精品一区二区公牛电影院 | 我要看WWW免费看插插视频| 亚洲色偷偷偷综合网| 免费在线精品视频| 中国毛片免费观看| 中文字幕亚洲第一在线| 久久精品女人天堂AV免费观看 | 久久久精品视频免费观看| 亚洲国产高清视频| 我想看一级毛片免费的| 日韩大片免费观看视频播放 | 欧美激情综合亚洲一二区| 亚洲午夜精品一级在线播放放| 国产麻豆成人传媒免费观看| 亚洲国产综合第一精品小说| 在线A级毛片无码免费真人| 一级特黄色毛片免费看| 亚洲最新在线视频| 四虎永久免费网站免费观看| 十八禁视频在线观看免费无码无遮挡骂过| 久久夜色精品国产噜噜噜亚洲AV| 美女裸身网站免费看免费网站| 日韩毛片在线免费观看| 亚洲美女视频网址| 久久久精品国产亚洲成人满18免费网站 | 两性色午夜视频免费播放| 亚洲av永久无码精品天堂久久 | 亚洲国语在线视频手机在线|