Memorize Python commentary 2 --Strings

print("Giraffe\nAcademy") # new line print("Giraffe\"Academy") # escape sequence print("Giraffe\\Academy")

phrase = "Giraffe Academy" print("\n\n" + phrase) # appending another strings is concatenation (+)

# function print(phrase.lower()) print(phrase.upper()) print(phrase.isupper())

# function in combination print(phrase.upper().isupper())

# length function print(len(phrase))

# index of the character print(phrase[0])

# passing a parameter print(phrase.index("a")) print(phrase.index("Acad"))

# In here I can actually give this two parameters so I can give this replace function two values that it can use. print(phrase.replace("Giraffe", "Elephant"))

Recommended Posts

Memorize Python commentary 2 --Strings
Memorize Python commentary 3 --Numbers
Memorize Python commentary 4 --Input
Memorize the Python commentary on YouTube.
Compare strings in Python
Reverse strings in Python
3-3, Python strings and character codes
Search for strings in Python
Python
[Introduction to Python3 Day 13] Chapter 7 Strings (7.1-7.1.1.1)
[Introduction to Python3 Day 14] Chapter 7 Strings (7.1.1.1 to 7.1.1.4)
[Introduction to Python3 Day 15] Chapter 7 Strings (7.1.2-7.1.2.2)
ABC128 A, B, C commentary (python)
Extract strings from files in Python
Change the length of Python csv strings
Python numbers, strings, list types (Python learning memo ①)
Python strings become f strings by default (maybe)
Personal tips about Python (strings, around logs)
[Introduction to Udemy Python3 + Application] 11. Character strings
Bulk replacement of strings in Python arrays
[Python] Various combinations of strings and values
Python commentary whose parents were killed literally