Let's say I have this little piece of code:
<?php
$tmp = str_split('hello world!',2);
// $tmp will now be: array('he','ll','o ','wo','rl','d!');
foreach($tmp AS &$a) {
// some processing
}
unset($tmp);
?>
How can I do this in Python v2.7?
I thought this would do it:
the_string = 'hello world!'
tmp = the_string.split('',2)
for a in tmp:
# some processing
del tmp
but it returns an "empty separator" error.
Any thoughts on this?