You've already forked Curso-lenguaje-python
Restructure content and add notes from HolaMundo
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
55
python-total/dia_03/04_string.py
Normal file
55
python-total/dia_03/04_string.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# Métodos de strings
|
||||
|
||||
## Métodos de análisis
|
||||
|
||||
print("Hola mundo".count("Hola"))
|
||||
|
||||
print("Hola mundo".find("world"))
|
||||
|
||||
print("C:/python36/python.exe".rfind("/"))
|
||||
|
||||
print("Hola mundo".startswith("Hola"))
|
||||
|
||||
print("abc123".isdigit())
|
||||
|
||||
print("1234".isnumeric())
|
||||
|
||||
print("1234".isdecimal())
|
||||
|
||||
print("abc123".isalnum())
|
||||
|
||||
print("abc123".isalpha())
|
||||
|
||||
print("abcdef".islower())
|
||||
|
||||
print("ABCDEF".isupper())
|
||||
|
||||
print("Hola mundo".isspace())
|
||||
|
||||
print("hola mundo".capitalize())
|
||||
|
||||
print("Hola mundo".encode("utf-8"))
|
||||
|
||||
print("Hola mundo".replace("mundo", "world"))
|
||||
|
||||
print("Hola Mundo!".lower())
|
||||
|
||||
print("Hola Mundo!".upper())
|
||||
|
||||
print("Hola Mundo!".swapcase())
|
||||
|
||||
print(" Hola mundo! ".strip())
|
||||
|
||||
print("Hola".center(10, "*"))
|
||||
|
||||
print("Hola mundo!\nHello world!".split())
|
||||
|
||||
print("Hola mundo!\nHello world!".splitlines())
|
||||
|
||||
print("Hola mundo. Hello world!".partition(" "))
|
||||
|
||||
print("Hola mundo. Hello world!".rpartition(" "))
|
||||
|
||||
print(", ".join(["C", "C++", "Python", "Java"]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user