GentBG x PUSSTEEM - burning both STEEM and PUSS

Image
by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/gentbg-x-pussteem-burning-both-steem-and-puss Hello, this is @joviansummer(witness: @jswit), developer of GentBG project. I registered @gentbg account to PUSSTEEM about a week ago and donated some of my own PUSS token to @gentbg's EPUSS account. Now, @gentbg will burn STEEM and EPUSS at the same time. PUSSTEEM's boosting upvotes will help increasing baseline burning significantly. @gentbg's SP reward is delegate to @jsup to get automated upvotes, forming a baseline burning of liquid reward independent of other people's upvotes. Some may argue 100%(both liquid and SP reward) burning is much better, but I chose this approach to prevent @gentbg from becoming a spamming account. Constantly asking for upvotes via mentioning and commenting every week may eventually become a big annoyance to curators. That being said, anyone is welcome to participate in countering STEEM inflation by giving upvotes ...

파이썬에서 특정 파일이 존재하는지 확인하기

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/upz7a


인터넷에서 찾아봤다가 잊어버렸다가 나중에 다시 찾아보는 수고를 방지하기 위해서 현재 진행중인 작업과 관련하여 필요한 내용들을 시간 날 때마다 메모해 두려고 합니다.

파이선에서 파일 존재 여부를 확인하는 예시입니다. os 모듈을 활용합니다.

import os
# 현재 디렉토리 정보를 CUR_DIR에 할당
CUR_DIR = os.getcwd()
# 디렉토리 출력
print(CUR_DIR)

현재 디렉토리에 joviansummer.txt 파일이 존재하는지 확인합니다.

# 확인 대상 파일(리눅스 기준으로 구분자 "/" 사용)
target_file = CUR_DIR + "/joviansummer.txt"

# 대상 경로(path) 존재 여부 확인
if os.path.exists(target_file):
  print("경로가 존재합니다")
else:
  print("경로가 존재하지 않습니다")

os.path.exits()는 대상이 파일인지 디렉토리인지 관계 없이 해당 경로가 존재할 경우에 True가 됩니다. 대상이 "파일"인지를 특정해서 확인하기 위해 os.path.isfile()을 함께 AND(교집합) 조건으로 묶어줍니다.

# 대상 경로가 존재하고, 그것이 파일인지 확인
if (os.path.exists(target_file) and (os.path.isfile(target_file)):
  print("파일이 존재합니다.")
else:
  print("파일이 존재하지 않습니다.")

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기