About 7,410,000 results
Open links in new tab
  1. for loop - String split in python - Stack Overflow

    Apr 27, 2015 · I am trying to use split to put the name and each score into a variable but I am having trouble because each name has a variable amount of scores. How would I be able to …

  2. Python string.split more than one value in for loop

    Jul 23, 2015 · The reason it works outside of the for loop is because it sees the entire list at once versus one item at a time in the for loop and is able to unpack it. To fix it, you could split the …

  3. Python String split() Method - W3Schools

    The split() method splits a string into a list. You can specify the separator, default separator is any whitespace. Note: When maxsplit is specified, the list will contain the specified number of …

  4. How to Split a String by Index in Python? - Python Guides

    Oct 4, 2024 · To split a string by index in Python using list comprehensions and slicing, you can leverage the zip function to pair start and end indices, then slice the string accordingly.

  5. How to Split a String into List of Characters in Python?

    You can split a string into a list of characters in Python in many ways. In this tutorial, we will learn how to split a string into list of characters using for loop and List class. Examples

  6. Python - Split string into N equal parts - Python Examples

    To split a given string into N equal parts in Python, you can use a For loop with range from zero up to length of the string in steps of each part length, and use string slicing to find the …

  7. Python Split String (split, rsplit and splitlines) - A-Z Tech

    Mar 27, 2016 · Using for loop with split string method. As such, the split method returns a list of words, you may use the for loop to iterate through the list items after breaking the string. See …

  8. Python String Split Tutorial - Software Testing Help

    Apr 1, 2025 · Python String split is commonly used to extract a specific value or text from a given string. Python provides an in-built method called split() for string splitting. This tutorial will …

  9. Python – Splitting Text and Number in string - GeeksforGeeks

    Jan 20, 2025 · Given a string containing both letters and numbers, the task is to separate the text (letters) and the numbers into two separate outputs. For example, if the input is "abc123", the …

  10. python - how to split a string in a for loop - Stack Overflow

    Oct 23, 2015 · Either fix your data or guard your logic with an if-statment: a = i.split('from ') if len(a) > 1: a = a[1] test.append(a) My guess is that one of your sites is an empty string. If you want …