You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

30 lines
522 B

  1. \begin{frame}[fragile]
  2. \frametitle{Slicer des strings}
  3. \begin{lstlisting}
  4. >>> message = "Bonjour, monde !"
  5. >>> message[0] # ça commence à zéro
  6. "B"
  7. >>> message[15]
  8. "!"
  9. >>>> message[-1] # compter à l'envers
  10. "!"
  11. \end{lstlisting}
  12. \end{frame}
  13. \begin{frame}[fragile]
  14. \frametitle{Slicer des strings (2)}
  15. \begin{lstlisting}
  16. >>> message = "Bonjour, monde !"
  17. >>> message[1:4] # début, fin
  18. 'onj'
  19. >>> message[:7] # début implicite
  20. 'Bonjour'
  21. >>> message[9:-2] # fin négative
  22. 'monde'
  23. \end{lstlisting}
  24. \end{frame}