aboutsummaryrefslogtreecommitdiff
path: root/challenge-253/steve-g-lynn/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-253/steve-g-lynn/python/ch-1.py')
-rw-r--r--challenge-253/steve-g-lynn/python/ch-1.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-253/steve-g-lynn/python/ch-1.py b/challenge-253/steve-g-lynn/python/ch-1.py
new file mode 100644
index 0000000000..bc625f1ae2
--- /dev/null
+++ b/challenge-253/steve-g-lynn/python/ch-1.py
@@ -0,0 +1,20 @@
+
+# Python 1.4 beta on DOSBOX
+
+import string
+
+def split_strings(arrStr, sep):
+ retval=[] #array to be returned
+ for str in arrStr:
+ str_split=string.splitfields( str, sep )
+ for item in str_split:
+ if (item != ""):
+ retval.append(item)
+ return retval
+
+print split_strings(("one.two.three","four.five","six"),".")
+#['one','two','three','four','five','six']
+
+print split_strings(("$perl$$","$$raku$"),"$")
+#['perl','raku']
+