'2023/02/04'에 해당되는 글 1건

  1. 2023.02.04 [Python] Python 소소한 기능들
Coding/Python 삽질기2023. 2. 4. 01:33

1.  f-string 예제

def f_string_test():
    rate = int(100_000_000 * 0.05 / 12)
    print(f'[{rate}]')
    # 3자리 마다 , 표시
    print(f'[{rate:,}]')
    # < : 좌측 정렬
    print(f'[{rate:<11}]')
    # < : 좌측 정렬, 빈칸은 _로 채우기
    print(f'[{rate:_<11,}]')
    # ^ : 가운데 정렬, 빈칸은 _로 채우기, 3자리 마다 , 표시
    print(f'[{rate:_^11,}]')
    # > : 우측 정렬, 빈칸은 _로 채우기, 3자리 마다 , 표시
    print(f'[{rate:_>11,}]')


if __name__ == '__main__':
    f_string_test()

2. ... 

def f_string_test():
    ...


if __name__ == '__main__':
    f_string_test()

'Coding > Python 삽질기' 카테고리의 다른 글

[Python] Cycloid 곡선 그리기  (0) 2023.03.09
[Design Pattern] Singleton pattern  (0) 2022.07.12
About Pyscript  (0) 2022.06.10
Posted by chobocho