This commit is contained in:
2019-05-12 16:17:58 +02:00
parent 941984f1ee
commit afc8ff0845
24 changed files with 945 additions and 35 deletions

View File

@@ -2,6 +2,51 @@
```python
>>> mon_str = "bonjour"
>>> print(mon_str)
bonjour
>>> long_str = """***********
... * Bonjour *
... ***********
... """
>>> long_str
'***********\n* Bonjour *\n***********\n'
>>> print(long_str)
***********
* Bonjour *
***********
```
```python
# Concaténation
>>> mon_str + " Bruno"
'bonjour Bruno'
# Répétition
>>> "ha " * 5
'ha ha ha ha ha '
# Longueur de la chaine
>>> len(mon_str)
7
# Indice
>>> mon_str[0]
'b'
>>> mon_str[6]
'r'
>>> mon_str[len(mon_str)-1]
'r'
>>> mon_str[-1]
'r'
>>> mon_str[-3]
'o'
```
##### str.count()
```python