Computer Science/알고리즘 ( Algorithm )

python string 다루기

bugtype 2019. 1. 1. 14:56

test = "Hello World 2019"
test2 = "Bugtype"
print (test.find("e"))

print (test.lower())

print (test[3:])
print (test[:3])

print (test[::2])
print (test[::3])
print (test[::4])

print (test.split(" "))
print ([x for x in test])
print (sorted([x for x in test]))

print ("%s by Bugtype" % test)
print ("{:} by Bugtype".format(test,test2))
print ("{1} by Bugtype".format(test,test2))


1

hello world 2019

lo World 2019

Hel

HloWrd21

HlWl29

Hor2

['Hello', 'World', '2019']

['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', ' ', '2', '0', '1', '9']

[' ', ' ', '0', '1', '2', '9', 'H', 'W', 'd', 'e', 'l', 'l', 'l', 'o', 'o', 'r']

Hello World 2019 by Bugtype

Hello World 2019 by Bugtype

Bugtype by Bugtype



'Computer Science > 알고리즘 ( Algorithm )' 카테고리의 다른 글

Codility - Nesting  (0) 2019.03.11
Codility - CyclicRotation  (0) 2019.03.11
Codility - Binary gap  (0) 2019.03.11
카카오 오픈채팅방  (0) 2019.01.30
[python] list 가지고 놀기  (0) 2018.12.22