From 6e3475e4050d9dbf64f83af62388d91708dc43f1 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Mon, 11 Jan 2010 17:38:22 -0500 Subject: [PATCH] typo [thanks GG] --- strings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings.html b/strings.html index f909fe5..edc98c7 100755 --- a/strings.html +++ b/strings.html @@ -261,7 +261,7 @@ experience of years. {'password': 'PapayaWhip', 'user': 'pilgrim', 'database': 'master'}
    -
  1. The split() string method takes one argument, a delimiter, and split a string into a list of strings based on the delimiter. Here, the delimiter is an ampersand character, but it could be anything. +
  2. The split() string method takes one argument, a delimiter, and splits a string into a list of strings based on the delimiter. Here, the delimiter is an ampersand character, but it could be anything.
  3. Now we have a list of strings, each with a key, followed by an equals sign, followed by a value. We can use a list comprehension to iterate over the entire list and split each string into two strings based on the first equals sign. (In theory, a value could contain an equals sign too. If we just used 'key=value=foo'.split('='), we would end up with a three-item list ['key', 'value', 'foo'].)
  4. Finally, Python can turn that list-of-lists into a dictionary simply by passing it to the dict() function.