Write Python code to convert string to list


Topic: Write Python code to convert string to list

Solution

def Convert_1(string): 
    li = list(string.split(" ")) 
    return li 
 
str1 = "Geeks for Geeks"
print(Convert(str1)) 
def Convert_2(string): 
    li = list(string.split("-")) 
    return li 
str1 = "Geeks-for-Geeks"
print(Convert(str1)) 



List all Python Programs