f-string에서 중괄호 출력 방법
중괄호 두번써주면 됨
name ='김초보'
f'''
{{{name}}}
'''
# 결과 {김초보}
[python] 파이썬 f-string (문자열 포매팅 방법 3)
안녕하세요. BlockDMask 입니다. 오늘은 파이썬 문자열 포매팅 방법 % 서식문자, str.format, f-string 이 세개 중 마지막인 f-string에 대해서 알아보려고 합니다. % 서식문자 [바로가기] str.format [바로가기].
blockdmask.tistory.com
pythonstudy.xyz/python/article/509-%EB%82%9C%EC%88%98-random
예제로 배우는 파이썬 프로그래밍 - 난수 (random)
난수 (random) 파이썬에서 난수(random number)를 사용하기 위해서는 기본적으로 제공되는 random 모듈을 사용한다. random 모듈에서 자주 사용되는 함수는 다음과 같다. randint(최소, 최대) : 입력 파라미터
pythonstudy.xyz
[Python] 특정 문자열 제거하는 방법
문자열을 처리하다보면, 특정한 문자열 혹은 기호를 제거하려고 시도하는 경우가 발생합니다. 특히, \n 이나 \t 같은 기호를 제거하는 경우가 많은데 특정 문자열을 제거할 때 편하게 쓸 수 있는
seokhyun2.tistory.com
python 일정 기간의 날짜 출력 방법
python을 가지고 일정 기간의 날짜를 출력하고자 합니다.예를 들면 20160901부터 20161031까지입니다.하지만 단순히 range를 가지고 date1 = int('20160901') date2 = int('20161032') for x in range(date1, date2): print x 이
hashcode.co.kr
import datetime
a = datetime.datetime.today()
numdays = 100
base = datetime.datetime.today()
date_list = [base - datetime.timedelta(days=x) for x in range(numdays)]
stackoverflow.com/questions/993358/creating-a-range-of-dates-in-python
Creating a range of dates in Python
I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? import datetime a = datet...
stackoverflow.com
stackoverflow.com/questions/993358/creating-a-range-of-dates-in-python
Creating a range of dates in Python
I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? import datetime a = datet...
stackoverflow.com
opentutorials.org/module/2980/17644
출력결과 파일로 저장하기 - 파이썬_실전 프로젝트
방법 1. 파이썬3 명령어 출력된 결과가 많거나, 결과물의 텍스트 파일이 필요할때, 출력 결과를 텍스트 파일로 저장할수도 있습니다. import sys sys.stdout = open('output.txt','w') print('hello !!!') 이렇게
opentutorials.org
[Python]파이썬 자리수 조절(소수점,올림,반올림)
실수를 표현할때, 자리수를 원하는대로 조절하고, 정수의 올림 반올림을 하고싶을때 사용하는 함수가있다. 반올림 소수점을 n번째 까지만 표현하고 반올림을 하고싶을때, round 함수를 사용하면
dpdpwl.tistory.com
Python 리스트 크기 구하기
listA = [1,2,3,4,5] listB = [6,7,8] listC = listA + listB size = len(listC) print(size)
lelecoder.com
[Python]파이썬 자리수 조절(소수점,올림,반올림)
실수를 표현할때, 자리수를 원하는대로 조절하고, 정수의 올림 반올림을 하고싶을때 사용하는 함수가있다. 반올림 소수점을 n번째 까지만 표현하고 반올림을 하고싶을때, round 함수를 사용하면
dpdpwl.tistory.com
'Python' 카테고리의 다른 글
[Python] 날짜 구하기 (날짜 리스트 만들기) (0) | 2021.04.07 |
---|---|
[PYTHON] TXT 파일 생성 / 수정 / 읽기 (한글깨짐) (0) | 2021.04.07 |
[PYTHON] 파이썬 Flask 사용법 2 (Jinja2 템플릿, 변수, 조건문/반복문) (0) | 2021.03.30 |
[PYTHON] .gitignore pycache not working (0) | 2021.03.17 |
[python] 파이썬 format 함수 (문자열 포매팅 방법) (0) | 2021.03.12 |