Browse Source

Regex and plot additions and corrections

pull/3/head
Jure Šorn 7 years ago
parent
commit
b06caa9c04
1 changed files with 14 additions and 8 deletions
  1. 22
      README.md

22
README.md

@ -147,9 +147,10 @@ String
```python
str.replace(text, old, new)
<str>.isnumeric()
<str>.split()
<str>.split(sep=None, maxsplit=-1)
<str>.strip()
<str>.join(<list>)
<str>.startswith(<str>)
```
### Print
@ -160,10 +161,15 @@ print(<el> [, <el>, end='', sep='', file=<file>])
### Regex
```python
import re
re.sub(<regex>, new, text)
re.sub(<regex>, new, text) # Use r'\1' for backreference.
re.search(<regex>, text)
re.match(<regex>, text) # Searches only at the beginning of the string.
re.findall(<regex>, text)
re.split(<regex>, text) # Use brackets in regex to keep the matches.
```
#### Parameter flags=re.IGNORECASE can be used with all functions.
### Format
```python
'{}'.format(<el> [, <el>, ...])
@ -431,7 +437,7 @@ import json
### Serialization
```python
<str> = json.dumps(<object>)
<str> = json.dumps(<object>, ensure_ascii=False, indent=2)
<object> = json.loads(<str>)
```
@ -444,7 +450,7 @@ with open(filename, encoding='utf-8') as file:
### Write to File
```python
with open(filename, 'w', encoding='utf-8') as file:
json.dump(<object>, file)
json.dump(<object>, file, ensure_ascii=False, indent=2)
```
SQLite
@ -688,10 +694,10 @@ Libraries
Plot
----
```python
import matplotlib
matplotlib.pyplot.plot(<data> [, <data>])
matplotlib.pyplot.show()
matplotlib.pyplot.savefig(filename)
from matplotlib import pyplot
pyplot.plot(<data> [, <data>])
pyplot.show()
pyplot.savefig(filename)
```
Web

Loading…
Cancel
Save