차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:python [2018/12/19 21:02] – [파일처리모드] V_Ltech:python [2018/12/19 21:11] (현재) – [변수] V_L
줄 23: 줄 23:
 =====변수===== =====변수=====
  
 +선언이 필요없다.
 ====배열==== ====배열====
  
줄 33: 줄 34:
  
 (([[https://flowarc.tistory.com/entry/파이썬Python-배열-리스트List|[Jamin's Dev log]]])) (([[https://flowarc.tistory.com/entry/파이썬Python-배열-리스트List|[Jamin's Dev log]]]))
 +=====문자열=====
 +
 +====대소문자 변환====
 +
 +<file python>
 +  s="IamWonDeRful"
 +  print(s.lower())
 +  print(s.upper())
 +</file>
 +====공백 처리====
 +
 +파이썬에서 공백을 처리 하는 방법(([[http://trendfollow.tistory.com/17|[낙낙™ 트렌드]]]))
 +
 +
 +
 +===문자열 양쪽의 공백을 제거 ===
 +
 +  str.strip([chars])
 +
 +
 +
 +  print( '   spacious   '.strip() )
 + 
 + 
 +
 +
 +===모든 스페이스(' ')를 제거===
 +  str.replace(old, new[, count])
 +
 +   ' hello world '.replace(" ", "")
 + 
 +
 +
 +===모든 공백문자를 제거 ===
 +
 +re모듈(정규식)
 +
 +
 +
 +<file python>
 +import re
 +
 +pattern = re.compile(r'\s+')
 +
 +sentence = re.sub(pattern, '', sentence)
 +</file>
 +
 + 
 +
  
 =====파일처리===== =====파일처리=====