We took a string, string1 as “1 2 3 4 5 6 7 8” and print it and its type() consecutively.#typecasting the individual elements of the string list into integer using the map() method Print("Converted string to list : ",list1) #converting the string into list of strings Print("Actual String containing integers: ",string1) Let us look at how we can convert the such type of string to a list in Python. Note, mass type-casting was performed using the map() functionĪ CSV( Comma Separated Values) string, as its name suggests is a string consisting of values or data separated by commas. As we saw in our previous case this gives us a list consisting of character lists.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |