@@ -1211,6 +1211,7 @@ Plot
12111211``` python
12121212# $ pip3 install matplotlib
12131213from matplotlib import pyplot
1214+
12141215pyplot.plot(< data_1> [, < data_2> , ... ])
12151216pyplot.show()
12161217pyplot.savefig(< filename> , transparent = True )
@@ -1223,6 +1224,7 @@ Progress Bar
12231224# $ pip3 install tqdm
12241225from tqdm import tqdm
12251226from time import sleep
1227+
12261228for i in tqdm(range (100 )):
12271229 sleep(0.02 )
12281230for i in tqdm([1 , 2 , 3 ]):
@@ -1237,6 +1239,7 @@ Table
12371239# $ pip3 install tabulate
12381240import csv
12391241from tabulate import tabulate
1242+
12401243with open (< filename> , newline = ' ' ) as csv_file:
12411244 reader = csv.reader(csv_file, delimiter = ' ;' )
12421245 headers = [a.title() for a in next (reader)]
@@ -1273,6 +1276,7 @@ Image
12731276``` python
12741277# $ pip3 install pillow
12751278from PIL import Image
1279+
12761280width, height = 100 , 100
12771281img = Image.new(' L' , (width, height), ' white' )
12781282img.putdata([255 * a/ (width* height) for a in range (width* height)])
@@ -1292,6 +1296,7 @@ Audio
12921296#### Saves a list of floats with values between 0 and 1 to a WAV file:
12931297``` python
12941298import wave, struct
1299+
12951300frames = [struct.pack(' h' , int ((a- 0.5 )* 60000 )) for a in < list > ]
12961301wf = wave.open(< filename> , ' wb' )
12971302wf.setnchannels(1 )
@@ -1429,6 +1434,7 @@ timeit('"-".join(str(a) for a in range(100))',
14291434# $ pip3 install pycallgraph
14301435from pycallgraph import output, PyCallGraph
14311436from datetime import datetime
1437+
14321438graph = output.GraphvizOutput()
14331439time_str = datetime.now().strftime(' %Y%m%d %H%M%S' )
14341440graph.output_file = f ' profile- { time_str} .png '
0 commit comments