What does the colon inside the parameter mean?

What does the colon mean in words_pron_dict: str? I get a syntax error in Python 2.7. Is it python 3? How can i use this?

class TextToSpeech: CHUNK = 1024 def __init__(self, words_pron_dict:str = 'cmudict-0.7b.txt'): self._l = {} self._load_words(words_pron_dict) 
+18
source share
1 answer

This is an annotation of the type: https://docs.python.org/3/library/typing.html

You can simply delete it.

+14
source

Source: https://habr.com/ru/post/1014079/


All Articles