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

파이썬에서 문자열의 일부를 가져오기

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


파이썬에서 문자열을 사용할 때 특정 위치의 글자들을 편리하게 가져올 수 있습니다.

x = 'hello world'

위와 같이 x에 문자열 'hello world'를 할당해 주었습니다. 첫번째 글자, 두번째 글자 등 특정 위치의 글자 하나를 가져오려면 아래의 예시처럼 할 수 있습니다.

# 문자열 x의 첫번째 글자 출력
print(x[0])

h

x[0]이 첫번째 글자인 'h', x[1]이 두번째 글자인 'e'가 됩니다.

범위를 지정할 수도 있습니다. 만약 첫번째부터 세번째 글자까지 가져오고 싶다면 x[0:3] 이렇게 설정합니다.

# 문자열 x의 첫번째부터 세번째 글자까지 출력
print(x[0:3])

hel

유의할 점은, 위치가 0부터 시작하고, 콜론(:) 다음에 지정되는 인덱스값은 출력값에 포함되지 않는다는 점입니다. x[0:3]이면 x[0]부터 x[2]까지 가져오는 것입니다.

특정 위치부터 마지막까지 가져올 수도 있습니다. 끝나는 위치를 지정하지 않으면 됩니다.

# 2번째 글자부터 끝까지 출력
print(x[1:])

ello world

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