Salut à tous,

je viens d'apercevoir que Google propose d'excellents cours de programmation en python sous forme de vidéo. Et je crois bien qu'on peut aussi récupérer le matériel.

http://code.google.com/edu/languages/google-python-class/

Alors pour ceux qui s'intéressent à ce langage <troll> ou ceux qui utilise encore Perl</troll>, je vous convie à visionner ces qques vidéos en anglais.

Et puis pour les vieux brise-car comme moi, j'ai appris:

sorted( [1,4,3,7] ) est préféré à [1,4,3,7].sort()
ces dex fonctions ne fonctionne pas du tout de la même manière. Et la vidéo vaut un coup d’œil.
vidéo:
  http://www.youtube.com/watch?v=EPYupizJYQI
  à 14min 40sec
doc:
  http://wiki.python.org/moin/HowTo/Sorting/

qu'on peut utiliser : 1 in {1:11,2:22}

que lire un fichier peut se faire de la manière:
f=open(filename, 'rU')
for line in f:
  print line,
vidéo:
  http://www.youtube.com/watch?v=haycL41dAhg
  à 11min 00sec

que pour éviter des problèmes d'échappement multiples pour les RE soit pour les Expressions Rationnelles, on peut mettre un préfixe r à la chaîne
video:
  http://www.youtube.com/watch?v=kWyoYtvJpe4
  11min 40sec
doc:
  http://docs.python.org/library/re.html
  3ème paragraphe
-------
The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'. So r"\n" is a two-character string containing '\' and 'n', while "\n" is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.
-------

et qu'on peut mettre un "," à la fin d'un print
vidéo:
  http://www.youtube.com/watch?v=haycL41dAhg
  13min 10sec
doc:
  http://docs.python.org/reference/simple_stmts.html#print
  3ème pargraphe
-------
A '\n' character is written at the end, unless the print statement ends with a comma. This is the only action if the statement contains just the keyword print.
-------

cED
_______________________________________________
gull mailing list
[email protected]
http://forum.linux-gull.ch/mailman/listinfo/gull

Répondre à