Split string without delimiters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eddiefisher41
    New Member
    • Jun 2007
    • 15

    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
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by eddiefisher41
    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']
    >>>

    Comment

    • eddiefisher41
      New Member
      • Jun 2007
      • 15

      #3
      Sweet, should work fine.
      Cheers
      Ed

      Comment

      Working...