15. Lektion: Stringbearbeitung: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 8: | Line 8: | ||
'upper', '__bases__', '__dict__', 'center', 'encode', 'partition', | 'upper', '__bases__', '__dict__', 'center', 'encode', 'partition', | ||
'rpartition', 'splitlines'] | 'rpartition', 'splitlines'] | ||
>>> | |||
</pre> | |||
=== Groß- und Kleinschreibung=== | |||
<pre> | |||
>>> hallo = 'Hallo' | |||
>>> hallo_klein = hallo.lower() | |||
>>> hallo_klein | |||
'hallo' | |||
>>> hallo_gross = hallo.upper() | |||
>>> hallo_gross | |||
'HALLO' | |||
>>> | >>> | ||
</pre> | </pre> | ||
=== Von Whitespaces befreien=== | |||
=== Texte mit Werten auffüllen=== | |||
=== Texte ausrichten=== | |||
** https://en.wikipedia.org/wiki/ASCII | ** https://en.wikipedia.org/wiki/ASCII | ||
| Line 28: | Line 50: | ||
* input() | * input() | ||
** https://martinxpn.medium.com/getting-input-from-users-in-python-2-100-days-of-python-f2b87ae49834 | ** https://martinxpn.medium.com/getting-input-from-users-in-python-2-100-days-of-python-f2b87ae49834 | ||
== Navigation== | == Navigation== | ||
Revision as of 17:55, 27 September 2023
String Methoden
Die Klasse String enthält eine ganze Reihe von Methoden die einen komfortablen Umgang mit Strings ermöglichen. Der Umfang an Methoden ist bei Micropython reduziert.
>>> dir(str) ['__class__', '__name__', 'count', 'endswith', 'find', 'format', 'index', 'isalpha', 'isdigit', 'islower', 'isspace', 'isupper', 'join', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rsplit', 'rstrip', 'split', 'startswith', 'strip', 'upper', '__bases__', '__dict__', 'center', 'encode', 'partition', 'rpartition', 'splitlines'] >>>
Groß- und Kleinschreibung
>>> hallo = 'Hallo'
>>> hallo_klein = hallo.lower()
>>> hallo_klein
'hallo'
>>> hallo_gross = hallo.upper()
>>> hallo_gross
'HALLO'
>>>
Von Whitespaces befreien
Texte mit Werten auffüllen
Texte ausrichten
- https://en.wikipedia.org/wiki/ASCII
- https://nedbatchelder.com/text/unipain.html
- https://docs.microphyton.org/en/v1.12/genrst/builtin_types.html?highlight=ljust
- https://www.phyton-lernen.de/string-methode-center.htm
- https://en.wikipedia.org/wiki/ASCII
- https://nedbatchelder.com/text/unipain.html
- https://medium.com/@sami.hamdiapps/elevate-your-python-skills-string-comparison-python-made-easy-bd0b3b08b55b
- https://levelup.gitconnected.com/10-more-python-methods-for-manipulating-strings-545f73211d37
- .format und %
- input()
Zurück zu Micropython Kurs 2023 - Teil 1
Zurück zur "Micropython Kurs 2023" Startseite
Zurück zur Programmieren Startseite
Zurück zur Wiki Startseite