| Line 53: |
Line 53: |
| | === Numbers === | | === Numbers === |
| | === String === | | === String === |
| − | Strings can be subset, | + | String assingment:<br /> |
| | + | MyString = 'Hello World' OR MyString = "Hello World"<br /> |
| | + | Strings can be subset sliced: |
| | <source lang="python"> | | <source lang="python"> |
| | MyString = "Hello world" | | MyString = "Hello world" |
| | MyString[0:4]</source> | | MyString[0:4]</source> |
| − | Hel | + | Hel<br /> |
| − | === Lists === | + | |
| − | === Tuple === | + | in operator: to check if a substring is contained in a string<br /> |
| − | === Dictionary === | + | |
| | + | String library:<br /> |
| | + | <source lang="python"> |
| | + | str.lower() |
| | + | str.upper() |
| | + | str.capitalize() → Uppercases 1st char |
| | + | str.center(width[, fillchar]) |
| | + | str.endswith(suffix[, start[, end]]) |
| | + | str.find(substring[, start[, end]]) |
| | + | str.lstrip([chars]) |
| | + | str.rstrip([chars]) |
| | + | str.strip([chars]) |
| | + | str.replace(old, new[, count]) |
| | + | </source> |
| | + | === Collections === |
| | + | ==== List ==== |
| | + | ==== Tuple ==== |
| | + | ==== Dictionary ==== |
| | Key - Value pairs, | | Key - Value pairs, |
| | + | <source lang="python"> |
| | + | |
| | + | </source> |