diff --git a/README.md b/README.md index ccf1560..0a5c451 100644 --- a/README.md +++ b/README.md @@ -147,9 +147,10 @@ String ```python str.replace(text, old, new) .isnumeric() -.split() +.split(sep=None, maxsplit=-1) .strip() .join() +.startswith() ``` ### Print @@ -160,10 +161,15 @@ print( [, , end='', sep='', file=]) ### Regex ```python import re -re.sub(, new, text) +re.sub(, new, text) # Use r'\1' for backreference. re.search(, text) +re.match(, text) # Searches only at the beginning of the string. +re.findall(, text) +re.split(, text) # Use brackets in regex to keep the matches. ``` +#### Parameter flags=re.IGNORECASE can be used with all functions. + ### Format ```python '{}'.format( [, , ...]) @@ -431,7 +437,7 @@ import json ### Serialization ```python - = json.dumps() + = json.dumps(, ensure_ascii=False, indent=2) = json.loads() ``` @@ -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(, file) + json.dump(, file, ensure_ascii=False, indent=2) ``` SQLite @@ -688,10 +694,10 @@ Libraries Plot ---- ```python -import matplotlib -matplotlib.pyplot.plot( [, ]) -matplotlib.pyplot.show() -matplotlib.pyplot.savefig(filename) +from matplotlib import pyplot +pyplot.plot( [, ]) +pyplot.show() +pyplot.savefig(filename) ``` Web