随笔分类 -  python知识

摘要:练习题:制作表格 循环提示用户输入:用户名、密码、邮箱(要求用户输入的长度不能超过20个字符,如果超过则只有前20个字符有效),如果用户输入q或者Q表示不再继续输入,将用户的内容一表格形式打印 s = "" while True: v1 = input('请输入你的名字') v2 = input(' 阅读全文
posted @ 2020-04-14 23:17 飞鸟与新月 阅读(1327) 评论(0) 推荐(0)
摘要:print(type('李杰'.encode('utf-8')))#<class 'bytes'> print(type('李杰'.encode('gbk')))#<class 'bytes'> print(len('李杰'.encode('utf-8')))#6 print(len('李杰'.en 阅读全文
posted @ 2020-04-13 21:27 飞鸟与新月 阅读(1429) 评论(0) 推荐(0)
摘要:pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ lxml 转自:https://www.cnblogs.com/apple2016/p/9599350.html 阅读全文
posted @ 2020-03-25 14:25 飞鸟与新月 阅读(582) 评论(0) 推荐(0)
摘要:python中使用a = a + a创建了一个新的变量a,覆盖了之前的变量a。而使用a += a 则是直接对原变量 a 进行操作。下面通过几个例子进行说明: 1. a = [1,2,3] print(id(a))#打印内存地址 a+=a print(a) print(id(a)) 输出结果: 123 阅读全文
posted @ 2020-03-22 20:11 飞鸟与新月 阅读(3206) 评论(0) 推荐(0)
摘要:1.举例sort和sorted对列表排序,list=[0,-1,3,-10,5,9] #列表排序 list=[0,-1,3,-10,5,9] list.sort(reverse=False) print("list.sort在list基础上修改,无返回值",list) list=[0,-1,3,-1 阅读全文
posted @ 2020-03-16 14:02 飞鸟与新月 阅读(279) 评论(0) 推荐(0)