Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/readability/not_using_dict_keys_when_formatting_strings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Here is an example of formatting the string with values from the person. This is

person = {
'first': 'Tobin',
'age':20
'age': 20
}

print('{0} is {1} years old'.format(
Expand All @@ -33,7 +33,7 @@ Here is an example of formatting the string with values from the person. This is
person = {
'first': 'Tobin',
'last': 'Brown',
'age':20
'age': 20
}

# Bad: we have to change the replacement fields within
Expand All @@ -55,16 +55,16 @@ By using the dictionary keys in the string we are formatting, the code is much m

person = {
'first': 'Tobin',
'age':20
'age': 20
}

print('{first} is {age} years old'.format(**person))
# Output: Tobin is 20 years old

person = {
'first':'Tobin',
'first': 'Tobin',
'last': 'Brown',
'age':20
'age': 20
}
print('{first} {last} is {age} years old'.format(**person))
# Output: Tobin Brown is 20 years old
Expand Down