私信  •  关注

anon

anon 最近回复了
4 年前
回复了 anon 创建的主题 » 如何清除python 3.7.3shell中所有文本的屏幕?

这在idle的python shell中是不可能的。

the documentation 以下内容:

shell从不丢弃输出。

制表符使下列文本在下一个制表位结束后开始。(每8个字符出现一次)。换行符导致以下文本出现在新行上。根据操作系统和字体,其他控制字符将被忽略或显示为空格、方框或其他形式。

这意味着它是一个非常基本的shell,以线性方式输出所有文本。您需要在不同的shell中运行python来完成您想要的任务。

你可以这样做:

SQL Fiddle

MySQL5.6架构设置 :

CREATE TABLE fruit
    (`text` varchar(11), `id` int, `time_end` int, `parent_id` int)
;

INSERT INTO fruit
    (`text`, `id`, `time_end`, `parent_id`)
VALUES
    ('banana tree', 23, 200, 7),
    ('tomato vine', 84, 500, 7),
    ('pear tree', 13, 800, 7),
    ('apple tree', 40, 1000, 7),
    ('grape vine', 15, 1800, 7)
;

查询1 :

 SELECT a.text,a.id, a.time_end,
 IFNULL((select max(time_end) from fruit where time_end < a.time_end),0) as time_start,
 a.parent_id 
 FROM fruit a WHERE a.text LIKE '%tree'

Results :

|        text | id | time_end | time_start | parent_id |
|-------------|----|----------|------------|-----------|
| banana tree | 23 |      200 |          0 |         7 |
|   pear tree | 13 |      800 |        500 |         7 |
|  apple tree | 40 |     1000 |        800 |         7 |