Aquesta és una revisió antiga del document
Python strings
comp
- Exact match (equality comparison): ==, !=
- Partial match: in, not in
- Forward/backward match: startswith(), endswith()
- Order comparison: <, ⇐, >, >=
- Case-insensitive comparison: upper(), lower()
- Regex: re.search(), re.fullmatch()
string formatting
- string formatinghttps://realpython.com/python-string-formatting/- «string%s»%(param1)
- «string {} {}».format(1parm,2param)
- «string {1}{2}{1}».format(1param,2param«
- interpolación:f»string {name} {a + b}«
- Template strings
 
string fill
- ljust(),- rjust(),- center()
- %15s,- %15-s
- {:15},- {:>15}
/via:https://www.delftstack.com/es/howto/python/python-pad-string-with-spaces/
- zfill()
zero fill
- n=42
- print(f'{n:05d}')
- print('%05d' % n)
- print('{0:05d}'.format(n))
- 00042
/via: https://www.python-engineer.com/posts/pad-zeros-string/
concatenate
- s1+s2
- »%s %s«%(s1,s2)
- »-«.join([s1,s2])
- »{}{}«.format(s1,s2)
/via: https://www.tutorialspoint.com/how-to-concatenate-two-strings-in-python