STEEM POWER retention ratio of top 50 witnesses

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/steem-power-retention-ratio-of-top-50-witnesses Hello, this is @joviansummer(witness: @jswit). Some time ago there was a bit of discussion on discord witness chanel about witnesses' power-down/cashing-out. So out of curiosity I just checked current ratio of witnesses' own STEEM POWER(VESTS) and all-time producer reward(VESTS). The ratio is calculated by the following simple formula: ratio(%) = account's own SP(MV) / all-time producer reward SP(MV) * 100% Ratio value less than 100% indicates power-down. If witness does additional power-up or gets other types of reward(e.g., curation reward), the ratio may exceed 100%. This does not take witness' other accounts into consideration. All-time producer reward data is from @steemchiller's SDS API. Here is the result: rank account own_sp prod_sp ratio 1 justyy 2188.411MV 1284.2MV 170.41% 2 steemchiller 982.134MV 124...

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

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포스팅 강박에서 벗어나기