Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python type hint for a string

# Use ": str" after an argument name
# Use " -> str" in the function header before the ending colon
def greeting(name: str) -> str:
    return 'Hello, ' + name
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #python #type #hint #string
ADD COMMENT
Topic
Name
8+4 =