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

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/jsup-avle-code-update-you-don-t-have-to-write-post-everyday Hello, this is @joviansummer, developer of @jsup and@avle voting service. Voting service code for @jsup and @avle has been updated. I had been considering this update for a while, and recently I could come up with detailed implementation plan which resulted in a relatively swift code revision. The new added feature is capability to give daily upvote to the first thing you write for the day(timezone GMT+9) regardless of post or comment/reply. Writing a post everyday can be challenging. In that case, you can write a reply to receive daily upvote because writing a reply everyday is much easier and also a good way to engage in your community. Writing a post everyday just to get an upvote can be very tedious and exhausting, and post itself could easily become low-quality. There may be people who enjoy writing a post everyday, but we can't ignore th...

파이썬 관련 메모 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

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

[ENG] jsup 2.0 - make your upvote great again

[EN] STEEM-services: dapps/services webpage with sort and search functions