我有一个基于文本的程序,它在“while True:”样式循环中使用菜单和子菜单。您可以通过顶部菜单进入子菜单 - 已编辑以包含代码。
输出如下所示:
1 Collect Attachments
2 View Senders
3 Edit Senders
4 Quit
Choose an option: 1
Chose Collect Attachments
Enter a date dd-mm-yyyy: 21-01-2020
Enter how many days previous to search through: 7
Your search starts from 2020-01-21 00:00:00 and ends on 2020-01-14
0 Search Any
1 Hazel Blue
2 Duo Security
3 Esker Australia Pty Ltd
4 iiNet Billing Team
5 TeamViewer Sales
6 ple.com.au Gnangara Warehouse Team
7 info@thereceptionist.com.au
8 Amazon Web Services
There are 9 options.
Choose a sender (blank to exit):
You did not enter a valid number (ValueError)
问题是 ValueError 不应该出现在子菜单中。这都是自学的,所以我想我不明白异常处理是如何完成的。
千万里不及你
四季花海
相关分类