Python and Django

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

leo21c 2013. 1. 7. 21:10

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