-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_string.py
More file actions
55 lines (27 loc) · 942 Bytes
/
Copy path04_string.py
File metadata and controls
55 lines (27 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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"]))