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