I was wondering how I can split words in a nested list into their individual letters such that
[['ANTT'], ['XSOB']]
becomes
[['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a list comprehension:
Your input list simply contains nested lists with 1 element each, so we need to use
l[0]on each element.list()on a string creates a list of the individual characters:If you ever fix your code to produce a straight up list of strings (so without the single-element nested lists), you only need to remove the
[0]: