Site Tools


informatique:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatique:python [2024/12/11 23:02] yahikoinformatique:python [2026/04/22 14:24] (current) – [Le dernier caractère d'une chaîne] yahiko
Line 14: Line 14:
 python -m venv undossier python -m venv undossier
 .\undossier\Scripts\activate .\undossier\Scripts\activate
 +</code>
 +
 +===== pip =====
 +
 +==== Générer requirements.txt ====
 +
 +<code bash>
 +pip freeze > requierements.txt
 +</code>
 +
 +==== Installer depuis requierements.txt ====
 +
 +<code bash>
 +pip install -r requierements.txt
 </code> </code>
  
Line 92: Line 106:
 ===== Le dernier caractère d'une chaîne ===== ===== Le dernier caractère d'une chaîne =====
 <code python> <code python>
-print("Prout"[-1]+print("Prout"[-1])
 </code> </code>
 Va retourner ''t''. Va retourner ''t''.
Line 158: Line 172:
 <code python> <code python>
 def DashCheck(check): def DashCheck(check):
 + # On vérifie le dernier caractère de la chaîne
  if check[-1] == '-':  if check[-1] == '-':
 + # Si "-" alors on le supprime
  dash = check[:-1]  dash = check[:-1]
 + return dash
  else:  else:
- dash = str("Pas prout"+ return check
- return dash+
 </code> </code>
  
informatique/python.1733958178.txt.gz · Last modified: by yahiko