0

Hi I have a dynamic string and I want to create a list with the string in it.

Ex. a = "hello"
    b = xxx(a) should give ['hello']

when I try
    b = list(a), I get b = ['h','e','l','l','o']

How do I achieve this? Thanks.

1 Answer 1

5

Create a list with a single element instead:

b = [a]
Sign up to request clarification or add additional context in comments.

1 Comment

Hitting myself on the head. Thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.