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/2v14rm


파이선에서 텍스트 파일을 읽거나 쓰는 방법입니다.

먼저 텍스트 파일을 읽으려면 open() 함수에서 읽고자 하는 파일을 읽기(r) 모드로 지정합니다.

# test.txt 파일을 읽기 모드로 열어서 파일 객체 f에 할당
f = open('test.txt', 'r')

파일의 내용을 한꺼번에 읽을 경우에는 read()를 사용합니다. 읽은 후에는 열려 있는 파일을 닫아줍니다.

# 파일 객체 f에 의해 열려 있는 파일을 읽어서 문자열 전체를 변수 x에 할당
x = f.read()
f.close()

위의 예시에서는 여러줄로 된 내용 전체가 하나의 변수 x에 할당되었습니다. 만약 내용을 한줄씩 읽고 싶다면 readline()을 사용합니다.

예를 들어 파일의 내용을 한줄씩 읽어서 리스트(list)의 원소로 추가할 경우 아래와 같이 할 수 있겠습니다.

# 리스트 초기화
x_list = []
# 파일 열기
f = open('test.txt', 'r')
# 한줄씩 읽기 시작
while True:
  line_str = f.readline()
  if not line_str:
    # 읽은 줄이 null string일 경우 while 반복문 중단
    break
  else:
    # 리스트에 원소 추가
    x_list.append(line_str)
f.close()

Comments

Popular posts from this blog

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

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

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