About 50 results
Open links in new tab
  1. Returning a string in python - Stack Overflow

    I need to get a string returned to the calling function of a script. A module called 'utils' has the function being called for a return value. Trying to learn how exactly this works/what should be

  2. python - How do I get ("return") a result (output) from a function? How ...

    The natural, simple, direct, explicit way to get information back from a function is to return it. Broadly speaking, the purpose of a function is to compute a value, and return signifies "this is the value we …

  3. Python: can a function return a string? - Stack Overflow

    Nov 2, 2015 · Yes, a function can return a string. Your issue, at least one of your issues, is that you're not returning from the recursive call at all (e.g. return lsubstr(..)). Secondarily, what is a and b …

  4. python - How to return string from main function? - Stack Overflow

    Nov 12, 2020 · Python can't return strings to the OS - it can only return integers, like any other process. That main returns a string is meaningful only within Python.

  5. python return statement with strings and functions

    Apr 29, 2016 · One of those variables that you try to concatenate with strings is None. Strings can only be concatenated with other strings. My psychic debugging tells me that those functions you're calling …

  6. python - Return string and int from a function - Stack Overflow

    Jan 24, 2016 · return 'salad: {} hamburger: {} water: {}'.format(s, h, w) Unrelated: Your counting code is fragile. It happens to work correctly with this data set, because the letters shw only appear once each …

  7. How do I get a substring of a string in Python? - Stack Overflow

    Aug 31, 2016 · And just for completeness, Java is like Python in that the String.substring () method takes start and one-past-end. This one just bit me hard, I had assumed it was length like every other …

  8. python - Return statement on multiple lines - Stack Overflow

    Sep 1, 2013 · "I need to have line breaks in my return statement in order for the testing to return 'true'" - no, you don't. Most likely, you want a line break in the string you're returning, not in the return …

  9. How do I reverse a string in Python? - Stack Overflow

    There is no built in reverse method for Python's str object. How can I reverse a string?

  10. Check if a word is in a string in Python - Stack Overflow

    I'm working with Python, and I'm trying to find out if you can tell if a word is in a string. I have found some information about identifying if the word is in the string - using .find, but is there a way to do an if …