471,310 Members | 995 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Split string without delimiters

Hey Guys.
If I have a string say "abcdefg" how do i split the string without delimiters.
What i need is a list containing each of the chars:
e.g. ['a', 'b', 'c', 'd', 'e', 'f', 'g']

The string.split() method wont work as it requires a delimiter within the string to split on and returns ['abcdefg'].

Just going to use it for some error checking and validation used in a wx.TextCtrl in my GUI.
Cheers.
Ed
Jul 26 '07 #1
2 10816
bartonc
6,596 Expert 4TB
Hey Guys.
If I have a string say "abcdefg" how do i split the string without delimiters.
What i need is a list containing each of the chars:
e.g. ['a', 'b', 'c', 'd', 'e', 'f', 'g']

The string.split() method wont work as it requires a delimiter within the string to split on and returns ['abcdefg'].

Just going to use it for some error checking and validation used in a wx.TextCtrl in my GUI.
Cheers.
Ed
>>> list("abcdefg")
['a', 'b', 'c', 'd', 'e', 'f', 'g']
>>>
Jul 26 '07 #2
Sweet, should work fine.
Cheers
Ed
Jul 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by NewToThis | last post: by
4 posts views Thread by William Stacey [MVP] | last post: by
5 posts views Thread by kurt sune | last post: by
7 posts views Thread by lgbjr | last post: by
4 posts views Thread by Michele Petrazzo | last post: by
10 posts views Thread by teddyber | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.