파이썬에서 문자열은 문자를 더하기나 빼기를 이용하여 연결을 하거나 문자를 반복해서 실행을 하거나, 특정한 단어만을 출력하거나 대문자 소문자를 구분하거나, 문자의 출력갯수, 문자를 변경할수가 있습니다.
먼저 파이썬을 실행하기 위해서는 print(‘문자열’) 로 실행이 되며 예제를 보면 ‘hello ‘+’world’ 문자를 실행하면 문자가 연결되어 실행이 되며 ‘hello ‘*5 는 문자를 5번 출력을 하며, ‘hello'[0] 은 0번째 문자만을 실행합니다.
‘hello world’.cepitalize() 를 실행하면 첫번째 글자만 대문자로 변경되며, ‘hello world’.upper() 은 소문자를 전부 대문자로 변경하며 ‘hello world’.len() 는 몇개의 문자가 출력되었는지를 보여주게 됩니다.

print('hello '+'world') #문자와 문자를 연결
print('hello '*5) #문자를 5번 실행함
print('hello'[0]) # hello 문자 첫번째 단어만 출력
print('hello'[1])
print('hello'[2])
print('hello world'.capitalize()) #첫번째 글자를 대문자로 변경
print('hello world'.upper()) #소문자를 전부 대문자로 변경
print('hello world'.__len__()) #몇개의 문자 갯수 출력
print('hello world'.replace('world', 'programming')) #world 를 programming 로 변경
아래의 실행된 결과값을 살펴보게되면 지금까지 print() 출력한 값이 나타나게되면 위에서 이미 설명한것과 같으며 마지막 문자열은 ‘hello world’.replace(‘world’, ‘programming’) 는 hello world 문자가 hello programming 로 변경이 됩니다.

지금까지 파이썬을 이용한 문자열의 제어에서 데이터 입력, 데이터 합치기, 데이터 넣기 출력에 대해서 살펴보았습니다.