* Computer Science/py

join & traslate & title

soicem 2018. 3. 4. 22:19

-join

1
2
lst = 'best in the world'
' '.join(lst.split(' ')
cs


-title

1
2
lst = 'best in the world'
lst.title()
cs


-translate

1
2
3
4
5
6
7
intab = "a"
outtab = "b" # in/outtab must be same
deltab = "xm" #added line
trantab = str.maketrans(intab, outtab, deltab)
 
str = "this is string example....wow!!!"
print (str.translate(trantab))
cs


ref : tutorialspoint

'* Computer Science > py' 카테고리의 다른 글

bulk printer with py  (0) 2018.12.07
git bash에서 파이썬으로 git untracked files 제거  (0) 2018.08.15
collections  (0) 2018.07.09
Asterisk  (0) 2018.07.09
zip, enumurate, lambda, map reduce  (0) 2018.07.09