noor
noor

Reputation: 21

In Python how to convert a string into list

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)

Upvotes: 0

Views: 31

Answers (1)

oBObo2BI
oBObo2BI

Reputation: 84

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)

Upvotes: 1

Related Questions