猫史档案馆


【Python作品分享】Python3.8.1 Shell【教程贴】

用户:NyanCat_233NyanCat_233查看:12 回复:4 评论:12 创建时间:2020-03-09T10:55:54


【作品展示】

center_image

 

【作品介绍】

Python Shell,可以执行Python3.8.1脚本。

 

【作品源代码】

code = None
print('''Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.''')
while True:
    try:
        code = input('>>>')
        exec(code)
    except TypeError:
        print('TypeError')
        continue
    except NameError:
        print('NameError')
        continue
    except SyntaxError:
        print('SyntaxError')
        continue
    except ImportError:
        print('ImportError')
        continue
    except OSError:
        print('OSError')
        continue
    except IndexError:
        print('IndexError')
        continue
    except ValueError:
        print('ValueError')
        continue
    except TabError:
        print('TabError')
        continue
    except ZeroDivisionError:
        print('ZeroDivisionError')
        continue
    except UnicodeError:
        print('UnicodeError')
        continue

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
cool-creepercool-creeper

/********************************************************************************
** Form generated from reading UI file '����p14472.ui'
**
** Created by: Qt User Interface Compiler version 4.8.6
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef _65E5__5386_P14472_H
#define _65E5__5386_P14472_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCalendarWidget>
#include <QtGui/QHeaderView>
#include <QtGui/QWidget>

QT_BEGIN_NAMESPACE

class Ui_Numberguess
{
public:
    QCalendarWidget *calendarWidget;

    void setupUi(QWidget *Numberguess)
    {
        if (Numberguess->objectName().isEmpty())
            Numberguess->setObjectName(QString::fromUtf8("Numberguess"));
        Numberguess->resize(400, 300);
        calendarWidget = new QCalendarWidget(Numberguess);
        calendarWidget->setObjectName(QString::fromUtf8("calendarWidget"));
        calendarWidget->setGeometry(QRect(0, 0, 401, 301));

        retranslateUi(Numberguess);

        QMetaObject::connectSlotsByName(Numberguess);
    } // setupUi

    void retranslateUi(QWidget *Numberguess)
    {
        Numberguess->setWindowTitle(QApplication::translate("Numberguess", "Form", 0, QApplication::UnicodeUTF8));
        Numberguess->setProperty("Python", QVariant(QString()));
    } // retranslateUi

};

namespace Ui {
    class Numberguess: public Ui_Numberguess {};
} // namespace Ui

QT_END_NAMESPACE

#endif // _65E5__5386_P14472_H

点赞0


评论


JackuXLJackuXL

你这怕是积木拼的吧,实际可以不用列那么多错误种类,直接让程序识别错误然后报错即可

例如:

try:
    print("Hello Wolrd!")
except:
    print("error")

点赞0


评论


盒子的box盒子的box

if都用不了

点赞0


评论


TobylaiTobylai

试试把错误代码缩成两行:
try:exec(ode)
except Exception as e:print(e)

点赞0


评论