본문 바로가기
Python and Django

PHP's explode() 함수를 Python으로 처리할 경우

by leo21c 2013. 1. 7.
SMALL

string을 분할 하는 함수를 사용하면 된다.

import string
string.split(the_string, the_separator)

예를 들어 보면 아래와 같다.

>>>print "this is a test string!".split(' ')
['this', 'is', 'a', 'test', 'string!']
>>>print "this is a test string!".split(' ', 2)
['this', 'is', 'a test string!']


LIST

'Python and Django' 카테고리의 다른 글

Django File upload  (0) 2013.05.28
Apache와 Django 연결  (0) 2012.11.29
Python 이차원배열 생성 방법  (0) 2012.10.18
PIL을 이용한 그리기 part. 1  (0) 2012.09.06
PIL을 이용한 이미지 편집 part.1  (0) 2012.09.05