1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-11 17:24:29 +02:00
This commit is contained in:
miguel araujo
2014-06-19 11:05:48 -03:00
3 changed files with 15 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ language: json
filename: learnjson.json filename: learnjson.json
contributors: contributors:
- ["Anna Harren", "https://github.com/iirelu"] - ["Anna Harren", "https://github.com/iirelu"]
- ["Marco Scannadinari", "https://github.com/marcoms"]
--- ---
As JSON is an extremely simple data-interchange format, this is most likely going As JSON is an extremely simple data-interchange format, this is most likely going
@@ -14,6 +15,9 @@ going to be 100% valid JSON. Luckily, it kind of speaks for itself.
```json ```json
{ {
"key": "value",
"keys": "must always be enclosed in quotes (either double or single)",
"numbers": 0, "numbers": 0,
"strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".", "strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".",
"has bools?": true, "has bools?": true,
@@ -42,6 +46,12 @@ going to be 100% valid JSON. Luckily, it kind of speaks for itself.
[0, 0, 0, 1] [0, 0, 0, 1]
] ]
], ],
"alternative style": {
"comment": "check this out!"
, "comma position": "doesn't matter - as long as its before the value, then its valid"
, "another comment": "how nice"
},
"that was short": "And, you're done. You now know everything JSON has to offer." "that was short": "And, you're done. You now know everything JSON has to offer."
} }

View File

@@ -238,7 +238,10 @@ empty_set = set()
# Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry. # Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry.
some_set = {1, 1, 2, 2, 3, 4} # some_set is now {1, 2, 3, 4} some_set = {1, 1, 2, 2, 3, 4} # some_set is now {1, 2, 3, 4}
# Add more items to a set #Can set new variables to a set
filled_set = some_set
# Add one more item to the set
filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5} filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5}
# Do set intersection with & # Do set intersection with &

View File

@@ -46,6 +46,6 @@ lang: zh-cn
] ]
], ],
"that was short": "And, you're done. You know know everything JSON has to offer." "that was short": "And, you're done. You now know everything JSON has to offer."
} }
``` ```