Syntax of yaml file-None and "None" are different parameters, different meanings

yaml file syntax-None and "None"

Test Xiaobai, when using pycharm to adjust the interface, the problems encountered when writing scripts:
premise: yaml file

The first way to pass parameters-None:

yaml file:
Insert picture description here
adjust the interface, check the sent request parameters: The parameter in the
Insert picture description here
yaml file is not given a value, and the interface is adjusted, and it is found that None is sent in the request, which is equivalent to no value and no memory space is allocated.

The second way to pass parameters-"None":

Yaml file:
Insert picture description here
adjust the interface, check the sent request parameters: The
Insert picture description here
value of None is directly given in the yaml file, adjust the interface, and find that the string "None" is sent in the request.

in conclusion

  • The above two parameter transfer methods are different in the yaml file.
  • Secondly, if the passed parameter exists, the passed parameter is actually a string field (the second parameter passing method mentioned above).
  • If you want to pass a null value, you don't need to give a parameter, just write the key, and don't fill in the corresponding value (the first way of passing parameters above).

Extended learning:

The null value in the yaml file can also be represented by null or ~, that is, the following three parameter passing effects are the same:
Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_40734030/article/details/112603413