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)
Libra
2,6051 gold badge11 silver badges29 bronze badges
asked Nov 11, 2021 at 0:01
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)
answered Nov 11, 2021 at 0:05
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.