About 422,000 results
Open links in new tab
  1. python - How to concatenate (join) items in a list to a single string ...

    Sep 17, 2012 · For handling a few strings in separate variables, see How do I append one string to another in Python?. For the opposite process - creating a list from a string - see How do I split a …

  2. python - How to convert list to string - Stack Overflow

    Apr 11, 2011 · str(anything) will convert any python object into its string representation. Similar to the output you get if you do print (anything), but as a string.

  3. Coverting all the list elements to string using Python?

    Jan 6, 2021 · Another way to do the same thing is by using the map function in python. However for efficiency reason, the type of the output is of type Map[str] instead of type List[str].

  4. How would you make a comma-separated string from a list of strings?

    What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,...

  5. python - Convert a list with strings all to lowercase or uppercase ...

    I have a Python list variable that contains strings. Is there a function that can convert all the strings in one pass to lowercase and vice versa, uppercase?

  6. python - Convert all strings in a list to integers - Stack Overflow

    13 There are several methods to convert string numbers in a list to integers. In Python 2.x you can use the map function:

  7. python - How do I convert all of the items in a list to floats? - Stack ...

    (In Python 3, map ceases to return a list object, so if you want a new list and not just something to iterate over, you either need list(map(float, mylist) - or use SilentGhost's answer which arguably is more …

  8. python - How to sort a list of strings? - Stack Overflow

    Aug 30, 2008 · 8 But how does this handle language specific sorting rules? Does it take locale into account? No, list.sort() is a generic sorting function. If you want to sort according to the Unicode …

  9. How to check if a string is a substring of items in a list of strings

    This is quite an old question, but I offer this answer because the previous answers do not cope with items in the list that are not strings (or some kind of iterable object). Such items would cause the …

  10. Is there a better way to use strip() on a list of strings? - python

    Aug 29, 2012 · map(str.strip, my_list) is the fastest way, it's just a little bit faster than comperhensions. Use map or itertools.imap if there's a single function that you want to apply (like str.split)