@@ -1232,14 +1232,11 @@ for i in tqdm([1, 2, 3]):
1232
1232
1233
1233
Table
1234
1234
-----
1235
+ #### Prints CSV file as ASCII table:
1235
1236
``` python
1236
1237
# $ pip3 install tabulate
1237
1238
from csv import reader
1238
1239
from tabulate import tabulate
1239
- ```
1240
-
1241
- #### Prints CSV file as ASCII table:
1242
- ``` python
1243
1240
with open (< filename> , newline = ' ' ) as csv_file:
1244
1241
reader = reader(csv_file, delimiter = ' ;' )
1245
1242
headers = [a.title() for a in next (reader)]
@@ -1276,7 +1273,6 @@ Image
1276
1273
``` python
1277
1274
# $ pip3 install pillow
1278
1275
from PIL import Image
1279
-
1280
1276
width, height = 100 , 100
1281
1277
img = Image.new(' L' , (width, height), ' white' )
1282
1278
img.putdata([255 * a/ (width* height) for a in range (width* height)])
@@ -1296,7 +1292,6 @@ Audio
1296
1292
#### Saves a list of floats with values between 0 and 1 to a WAV file:
1297
1293
``` python
1298
1294
import wave, struct
1299
-
1300
1295
frames = [struct.pack(' h' , int ((a- 0.5 )* 60000 )) for a in < list > ]
1301
1296
wf = wave.open(< filename> , ' wb' )
1302
1297
wf.setnchannels(1 )
@@ -1434,7 +1429,6 @@ timeit('"-".join(str(a) for a in range(100))',
1434
1429
# $ pip3 install pycallgraph
1435
1430
from pycallgraph import output, PyCallGraph
1436
1431
from datetime import datetime
1437
-
1438
1432
graph = output.GraphvizOutput()
1439
1433
time_str = datetime.now().strftime(' %Y%m%d %H%M%S' )
1440
1434
graph.output_file = f ' profile- { time_str} .png '
0 commit comments