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,544
  • 1
  • 8
  • 24
noor
  • 11
  • 3
  • 1
    That's the correct function, what do you mean by "it isn't working?" – Libra Nov 11 '21 at 00:03
  • 2
    I don't know what is `txt` but if your variable `ST` holds these words then you should `ST.split(',')` – AlexDotis Nov 11 '21 at 00:05
  • 2
    Does this answer your question? [How to convert comma-delimited string to list in Python?](https://stackoverflow.com/questions/7844118/how-to-convert-comma-delimited-string-to-list-in-python) – bitski Nov 12 '21 at 13:32

1 Answers1

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)
oBObo2BI
  • 84
  • 2