Code Monkey home page Code Monkey logo

Comments (3)

wenbin3166 avatar wenbin3166 commented on May 22, 2024

在第九节的查找/替换value中“判断存在某个key”部分,所提到的这两个代码和搭配起来的实例我看不懂。
示例中的

input: d.get('陈二','此人不存在')
output: '此人不存在'我懂,就是返回'陈二'这个指定键的值吧?

但 d.get('key'),return None 这个代码我没看明白,我自己输入的结果是这样
2
网上搜索了get()函数的示意也没怎么懂,可以麻烦解释一下,并且附上实例吗?

(我知道这个问题很白痴,但真心求解,拜托了)

get(“陈二","此人不存在") 意思因该是查找键为陈二的值,如果没有陈二这个键就返回”此人不存在“

from girls-in-ai.

liwen211 avatar liwen211 commented on May 22, 2024

在第九节的查找/替换value中“判断存在某个key”部分,所提到的这两个代码和搭配起来的实例我看不懂。
示例中的
input: d.get('陈二','此人不存在')
output: '此人不存在'我懂,就是返回'陈二'这个指定键的值吧?
但 d.get('key'),return None 这个代码我没看明白,我自己输入的结果是这样
2
网上搜索了get()函数的示意也没怎么懂,可以麻烦解释一下,并且附上实例吗?
(我知道这个问题很白痴,但真心求解,拜托了)

get(“陈二","此人不存在") 意思因该是查找键为陈二的值,如果没有陈二这个键就返回”此人不存在“

那请问get('key'),return None的意思呢?我后来用代码输了一下,是这样的
image
又该怎么理解?
谢谢了!

from girls-in-ai.

RESET0898 avatar RESET0898 commented on May 22, 2024

小姐姐写的get('陈二'),return None的意思是type(get('陈二'))这个是NoneType

from girls-in-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.