[ENG] STEEM Security update - added power down alert

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/eng-steem-security-update-added-power-down-alert STEEM Security - receive STEEM alert messages via Discord Hello, this is @joviansummer(witness: @jswit). STEEM Security code has been revised. Previously, STEEM Security was sending alert message via discord for the following 3 kinds of operations: sending STEEM/SBD to another account changing SP delegation account update Now, power down operation has been added. If there is a power down operation, you will also receive alert message. Please check the original post of the above link for detailed information on how to use the service. Thank you for reading, and have a wonderful day! @joviansummer's STEEM projects @jswit witness: I'm running a STEEM witness node. I'd really appreciate it if you vote for my witness account @jswit. ( https://steemitwallet.com/~witnesses ) [ENG] Introducing @jswit witness project @jsup curation: [ENG] Int...

파이썬 관련 메모 2가지(일시정지, 하위 디렉토리 검색)

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


개발 작업 참고용으로 2가지 사항을 메모해 둡니다.

파이썬에서 코드 실행을 일정 시간 동안 정지하고 싶을 경우 time.sleep()을 사용합니다. 얼마 동안 정지할 것인지라 초로 지정할 수 있습니다.

import time

# 30초간 정지
time.sleep(30)

현재 디렉토리 하위에 있는 디렉토리와 파일을 검색하려면 os.walk()를 사용합니다. 경로(path), 해당 경로에 있는 디렉토리들, 해당 경로에 있는 파일들을 생성해줍니다. 디렉토리들과 파일들이 리스트(list) 형식으로 생성됩니다.

import os

# 현재 디렉토리를 파악하여 CUR_DIR에 할당
CUR_DIR = os.getcwd()

# 현재 디렉토리 하위에 있는 디렉토리와 파일 출력
for (path, dirs, files) in os.walk(CUR_DIR):
  print("경로: ", path)
  print("디렉토리: ", dirs)
  print("파일: ", files)
  print(" ")

만약 파일명만 골라서 하나씩 출력하려면 아래와 같이 할 수 있겠습니다.

for (path, dirs, files) in os.walk(CUR_DIR):
  for file in files:
    print("파일: ", file)

Comments

Popular posts from this blog

[ENG] jsup 2.0 - make your upvote great again

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

Nuitka - 파이썬 스크립트를 바이너리 실행 파일로 변환