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...

파이썬에서 실행 명령에 인자(argument) 지정

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


파이썬 스크립트를 실행할 때 실행 명령에 인자(argument)를 지정할 수 있습니다. 예를 들어 인자를 확인해서 이를 그대로 출력하는 스크립트 test.py를 만든다고 생각해 보겠습니다.

아래와 같은 실행 결과를 주는 스크립트입니다.

python3 test.py hello

test.py hello

python3 test.py hello world

test.py hello world

위의 스크립트는 아래와 같은 내용으로 작성되었습니다.

import sys

for arg in sys.argv:
  print(arg)

실행 명령의 인자는 sys.argv에 저장되며, 리스트(list) 형식입니다. 위의 예시에서는 for 반복문으로 sys.argv[0]부터 차례로 출력하였습니다.

2번째 예시의 경우(실행 명령: python3 test.py hello world) sys.argv에는 아래와 같이 값이 할당될 것입니다.

sys.argv[0]: 'test.py'(스크립트의 이름) sys.argv[1]: 'hello' (첫번째 인자) sys.argv[2]: 'world' (2번째 인자)

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