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 |
Tags
- cookie
- CSMA/CD
- 소셜로그인
- Arrays
- HTML
- EC2 is why EC2?
- 네트워크
- github
- stash
- 링크이동
- Decorator
- hub
- AWS 가입하기
- 영어 Frontend Article 읽고 요약하기 #6
- aws
- JWT기본원리
- JavaScript
- google font
- git stash
- 개발블로그 만들기
- vscode
- GitClone
- 카카오로그인
- localStorage
- css기초
- @
- 데코레이터
- ssh접속오류
- sessionStorage
- 무한스크롤
Archives
- Today
- Total
바다는 비에 젖지 않는다
[Python] f-string with for loops 본문
728x90
websites = (
"google.com",
"airbnb.com",
"https://twitter.com",
"facebook.com",
"https://tiktok.com",
)
for website in websites:
if not website.startswith("https://"):
website = f"https://{website}"
print(website)
f-string은 Python3.6 에서부터 문자열을 더 쉽게 포맷팅하기 위해 만들어진 기능이라고 한다.
f"" 따옴표 안에 수정하고싶은 문자열을 넣어 수정해줄수 있고 {}를 이용해 기존에 존재하는 변수를 수정해줄수 도 있다.

굉장히 편리한 기능인것 같다.
확실히 python이 재미있고 편한 기능들이 많은것 같다.
728x90
'IT Technical Note > Python' 카테고리의 다른 글
| [Python] Decorator and @ syntax in python(파이썬 데코레이터 @) (0) | 2024.04.03 |
|---|