参数里面的冒号是什么意思? [英] What does the colon inside the parameter mean?

查看:58
本文介绍了参数里面的冒号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

words_pron_dict:str 上的冒号是什么意思?我在 python 2.7 上遇到语法错误.是蟒蛇3吗?我该如何使用它?

What does the colon on words_pron_dict:str mean? I am getting syntax error on python 2.7. Is it python 3? How can i use it?

class TextToSpeech:
    CHUNK = 1024

    def __init__(self, words_pron_dict:str = 'cmudict-0.7b.txt'):
        self._l = {}
        self._load_words(words_pron_dict)

推荐答案

这是一个类型注解:https://docs.python.org/3/library/typing.html

您应该可以将其删除.

这篇关于参数里面的冒号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆