View Single Post
  #1 (permalink)  
Old 05-15-2007, 11:23 AM
Matt's Avatar   
Matt Matt is offline
Learning Programmer
 
Join Date: Jan 2007
Location: Northwestern US
Posts: 47
Rep Power: 7
Matt is on a distinguished road
Default Splitting Strings with Empty Separator (Python)

I have been playing around with Python lately, and there is one operation that I have yet to figure out how to do. This is splitting a string into its individual characters, which I used to be able to do with other languages by simply splitting with an empty separator. In python, however, this returns an error.

Code:
>>> "testing123".split("")
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in ?
    "testing123".split("")
ValueError: empty separator
How can I do this simple operation? Thanks...
__________________
http://www.mattnichols.net
Reply With Quote

Sponsored Links