Import all

This commit is contained in:
2020-05-05 09:53:14 +02:00
parent 0e4c9c0fea
commit 7de4bab059
1411 changed files with 163444 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
def display_file(name):
with open(name, 'rb') as f:
print("Voici les dix premiers caractères du fichier " +
name + " :")
for i in range(10):
c = f.read(1)
if len(c) == 0: # vrai si on est arrivé à la fin du fichier
break
print("Position " + str(i) + " : '" + c.decode('latin1') +
"' (code ASCII = " + str(ord(c)) + ")")
display_file('traitement-de-texte.odt')
display_file('lyon1.png')
display_file('display_file.py')
display_file('donnees-2-colonnes.csv')

View File

@@ -0,0 +1,3 @@
0, 10
1, 12
4, 15
1 0 10
2 1 12
3 4 15

View File

@@ -0,0 +1,5 @@
1
12.3
43
3
10

View File

@@ -0,0 +1,9 @@
# cf https://docs.python.org/fr/3/library/csv.html
import csv
fieldnames = ['x', 'y']
with open('donnees-2-colonnes.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile, fieldnames=fieldnames)
for row in reader:
print(row['x'], row['y'])

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB