File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/lang Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -604,7 +604,7 @@ data = {
604604} # {"key1": "value1", "key2": "value2"}
605605```
606606
607- We can ignore the key quotation marks when we writing simple literals on the key.
607+ We can ignore the attribute quotation marks when we writing simple literals on the key.
608608
609609``` python
610610data = {
@@ -613,6 +613,15 @@ data = {
613613} # {"key1": "value1", "key2": "value2"}
614614```
615615
616+ Note that when there is ` - ` , ` . ` and other hyphens in the attribute, we must use quotation marks.
617+
618+ ``` python
619+ data = {
620+ " config.dot.attr" = " value1" # Note we use `"config.dot.attr"` instead of `config.dot.attr` here.
621+ " config-hyphen-attr" = " value2" # Note we use `"config-hyphen-attr"` instead of `config-hyphen-attr` here.
622+ }
623+ ```
624+
616625In addition, the ** config selector expressions** can be used to init a dict instance with nested keys.
617626
618627``` python
Original file line number Diff line number Diff line change @@ -611,6 +611,15 @@ data = {
611611} # {"key1": "value1", "key2": "value2"}
612612```
613613
614+ 请注意,当属性中存在 ` - ` 和 ` . ` 等其他连字符时,我们必须使用引号。
615+
616+ ``` python
617+ data = {
618+ " config.dot.attr" = " value1" # Note we use `"config.dot.attr"` instead of `config.dot.attr` here.
619+ " config-hyphen-attr" = " value2" # Note we use `"config-hyphen-attr"` instead of `config-hyphen-attr` here.
620+ }
621+ ```
622+
614623此外,** 选择表达式** 可以用于定义包含嵌套键 dict 实例。
615624
616625``` python
You can’t perform that action at this time.
0 commit comments