Browse Source

Little corrections

pull/3/head
Jure Šorn 7 years ago
parent
commit
78c0fc9ee5
1 changed files with 5 additions and 3 deletions
  1. 8
      README.md

8
README.md

@ -185,6 +185,10 @@ re.search(<regex>, text)
>>> person = {'name': 'Jean-Luc', 'height': 187.1} >>> person = {'name': 'Jean-Luc', 'height': 187.1}
>>> '{p[height]:.0f}'.format(p=person) >>> '{p[height]:.0f}'.format(p=person)
'187' '187'
```
#### Or:
```python
>>> f"{person['height']:.0f}" >>> f"{person['height']:.0f}"
'187' '187'
``` ```
@ -434,9 +438,7 @@ with open(filename, encoding='utf-8') as file:
### Write to File ### Write to File
```python ```python
with open(filename, 'w', encoding='utf-8') as file: with open(filename, 'w', encoding='utf-8') as file:
json.dump(<object>, file)
# Or
file.write(json.dumps(<object>))
json.dump(<object>, file) # Or: file.write(json.dumps(<object>))
``` ```
SQLite SQLite

Loading…
Cancel
Save