https://opentutorials.org/course/1750
Python & Ruby - 생활코딩
수업의 특징 본 수업은 Python(파이썬)과 Ruby(루비), Ruby와 Python을 동시에 배우는 수업입니다. 저는 이것을 병렬학습이라고 부릅니다. 이를 통해서 프로그래밍 언어들을 관통하는 보편적인 원리를
opentutorials.org
파이썬
✔'hello world' #문자열의 첫글자를 대문자로 변경하고 싶을때
print('hello world'.capitalize()) # Hello world 출력됨
✔'hello world' # 전체를 대문자로 할때
print('hello world'.upper()) #HELLO WORLD 출력됨
✔print('hello world'.__len__()) # 문자열의 길이를 셀때
print(len('hello world')) # 괄호안의 문자의 갯수를 알려준다.
✔'hello world' # 문자를 다른 문자로 변환할때
print('hello world'.replace('world', 'programming'))
# '기존문자'.replace('변경하려는 문자', '변경할 문자')
루비
✔'hello world' #문자열의 첫글자를 대문자로 변경하고 싶을때
puts('hello world'.capitalize()) # Hello world 출력됨
✔'hello world' # 전체를 대문자로 할때
puts('hello world'.upcase()) #HELLO WORLD 출력됨
✔puts('hello world'.length()) # 문자열의 길이를 셀때
✔'hello world' # 문자를 다른 문자로 변환할때
puts('hello world'.sub('world', 'programming'))
# '기존문자'.sub('변경하려는 문자', '변경할 문자')