0

What command in python can be used to make the string ST = “WORK,IS,DONE” a list [“WORK”,”IS”,”DONE”]?

I am trying this but its not working

ST = txt.split(",")

print(ST)
3
  • 1
    That's the correct function, what do you mean by "it isn't working?" Commented Nov 11, 2021 at 0:03
  • 2
    I don't know what is txt but if your variable ST holds these words then you should ST.split(',') Commented Nov 11, 2021 at 0:05
  • 2
    Does this answer your question? How to convert comma-delimited string to list in Python? Commented Nov 12, 2021 at 13:32

1 Answer 1

1

Looks like you have the string defined under ST and not txt, which appears to be the issue.

st = "WORK,IS,DONE"
st = st.split(sep=",")
print(st)
Sign up to request clarification or add additional context in comments.

Comments

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.