Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Python
- MySQL
- line width
- AS
- Else
- For loops
- polynomial regression
- Text mining
- self parameter
- __init__
- Default X points
- start exercise
- error
- continue
- matplotlib
- matplotlib.pyplot
- break
- data distribution
- machine learning
- variables
- multiple lines
- Text Analytics
- Github
- SQL
- iterates
- pie charts
- PROJECT
- line color
- train/test
- PANDAS
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] Python Strings: Modify Strings 본문
반응형
- Upper Case
Example
The upper() method returns the string in upper case.
a = "Good Morning!"
print(a.upper())
- Lower Case
Example
The lower() method returns the string in lower case.
a = "Good Morning!"
print(a.lower())
- Remove Whitespace
Whitespace is the space before and/or after the actual text and if you want to remove it, you can use strip().
a = " Good Night! "
print(a.strip()) # returns "Good Night!"
- Replace String
If you want to replace a string, use replace().
a = "Hello, World!"
print(a.replace("H", "J"))
- Split String
The split() method returns a list where the text between the specified separator becomes the list items.
a = "Hello, World!"
print(a.split(",")) # returns ['Hello', ' World!']
'Python' 카테고리의 다른 글
Pandas Series (0) | 2023.10.26 |
---|---|
Pandas (0) | 2023.10.25 |
[Basic Grammar] Python Strings: Slicing Strings (1) | 2023.10.22 |
[Basic Grammar] Python Strings (1) | 2023.10.22 |
[Basic Grammar] Python Arrays (0) | 2023.10.21 |