From 146a87d0187c0d3207eb46f432768091897005ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 12 Jun 2018 17:53:28 +0200 Subject: [PATCH] Update --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01223f0..eb2cf19 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ List .sort() .reverse() = sorted() - = reversed() + = reversed() ``` ```python @@ -463,7 +463,8 @@ System ### Arguments ```python import sys -sys.argv +script_name = sys.argv[0] +arguments = sys.argv[1:] ``` ### Read File @@ -744,6 +745,16 @@ class BlaBla: Eval ---- +### Basic +```python +>>> import ast +>>> ast.literal_eval('1 + 1') +2 +>>> ast.literal_eval('[1, 2, 3]') +[1, 2, 3] +``` + +### Detailed ```python import ast import operator as op @@ -788,7 +799,7 @@ Plot from matplotlib import pyplot pyplot.plot( [, ]) pyplot.show() -pyplot.savefig(filename) +pyplot.savefig(filename, transparent=True) ``` Web @@ -981,8 +992,10 @@ bar.finish() Basic Script Template --------------------- ```python +# Linux: #!/usr/bin/env python3 -#!/usr/bin/python +# Mac: +#!/usr/local/bin/python3 # # Usage: .py #