20220215 TIL

강지훈·2022년 2월 15일

'''
문자열과 내장함수
'''

msg= "It is Time"
'''
print(msg.upper())
print(msg)
print(msg.lower())

tmp=msg.upper()
print(tmp)
#T라는 대문자를 찾아라
print(tmp.find('T'))
#처음으로 " "가있는 index를 출력해준다
print(tmp.find(" "))

#T의 개수를 출력
print(tmp.count("T"))
'''
print(msg)
#slice
print(msg[:2])
print(msg[3:5])

print(len(msg))
count=0
for x in msg:
if x == " ":
count=count+1

print(count)

for x in msg:
if x >= 'A'and x <='Z':
#if x.isupper():
print(x)

for x in msg:
if x.isalpha():
print(x,end='')
print()

tmp='AZaz'
#ord 아스키
#A=65 Z=90
#a=97 z=122
for x in tmp:
print(ord(x))

#아스키넘버를 문자로
tmp=65
print(chr(tmp))

profile
never stop

0개의 댓글