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

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

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

[ENG] jsup 2.0 - make your upvote great again

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

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