num_str = input('请输入数字字符串:') num_dict = {'0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine'}

将数字转换为英文单词

word_list = [num_dict[num] for num in num_str]

将单词用空格隔开并输出

print(' '.join(word_list))

Python 数字字符串转英文单词串

原文地址: https://www.cveoy.top/t/topic/oFui 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录