Capitaliser la première lettre dans Python
s = "python"
print("Original string:")
print(s)
print("After capitalizing first letter:")
print(s.capitalize())
Itchy Impala
s = "python"
print("Original string:")
print(s)
print("After capitalizing first letter:")
print(s.capitalize())
my_string = "car"
my_string.upper() # Makes EVERY letter uppercase
print(my_string)
>>> "CAR"
my_string = "car"
my_string.title() # Makes ONLY FIRST letter uppercase and others lowercase
print(my_string)
>>> "Car
# Use title() to capitalize the first letter of each word in a string.
name = "elon musk"
print(name.title())
# Elon Musk