上一页 1 2 3 4 5 6 7 ··· 17 下一页
摘要: 1.例子 /** * 泛型的使用 * 在集合中使用泛型 * 注意点: * 1.泛型的类型必须是类,不能是基本数据类型,需要用到基本数据类型的位置,需要使用其包装类 * 2.如果实例化时,没有指明泛型的类型,默认类型为java.lang.Object类型 */ public class Generic 阅读全文
posted @ 2022-02-13 23:45 从精通到陌生 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 1.字符串的内容对齐操作 s = 'hello,Python' '''居中对齐''' print(s.center(20,'*')) '''左对齐''' print(s.ljust(20,'*')) print(s.ljust(10)) print(s.ljust(20)) '''右对齐''' pr 阅读全文
posted @ 2021-12-15 00:20 从精通到陌生 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 1.字符串的创建和驻留机制 a='python' b="python" c='''python''' print(a,id(a)) print(b,id(b)) print(c,id(c)) 2.字符串的查找 '''字符串的查找操作''' s='hello,hello' print(s.index( 阅读全文
posted @ 2021-12-08 00:12 从精通到陌生 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1.集合的创建方式 #集合的创建方式 '''第一种创建方式使用{}''' s={2,3,4,5,5,6,7,7} #集合中的元素不允许重复 print(s) '''第二种创建方式使用set()''' s1 =set(range(6)) print(s1,type(s1)) s2=set([1,2,4 阅读全文
posted @ 2021-12-07 00:02 从精通到陌生 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 1.什么是元组 2.元组的创建方式 '''第一种创建方式,使用()''' t=('Python','world',99) print(t) print(type(t)) t2='Python','world',99 print(t2) print(type(t2)) t3=('Python',) # 阅读全文
posted @ 2021-12-01 00:07 从精通到陌生 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 1.什么是字典 2. 字典的创建 '''使用{}创建字典方式1''' scores={'张三':100,'李四':98,'王五':44} print(scores) print(type(scores)) '''第二种创建dict()''' student=dict(name='jack',age= 阅读全文
posted @ 2021-11-30 00:12 从精通到陌生 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 1.为什么需要列表 a=10 #变量存储的是一个对象的引用 lst=['hello','world',98] print(id(lst)) print(type(lst)) print(lst) 2.列表的创建 '''创建列表的第一种方式,使用[]''' lst =['hello','world', 阅读全文
posted @ 2021-11-28 23:22 从精通到陌生 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 1.pass语句 answer=input('您是会员吗?y/n:') #判断是否是会员 if answer=='y': pass else: pass 2.range()函数用法 #range()的三种创建方式 '''第一种创建方式,只有一个参数(小括号中只给了一个数)''' r=range(10 阅读全文
posted @ 2021-11-28 12:45 从精通到陌生 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 1.对象的布尔值 #测试对象的布尔值 print(' 以下对象布尔值全为False ') print(bool(False)) #False print(bool(0)) #False print(bool(0.0)) #False print(bool(None)) #False print(bo 阅读全文
posted @ 2021-11-21 22:19 从精通到陌生 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 1.print print('helloworld') print("helloworld") print(5) print(1+3) #将数据输出到文件中,注意点:1.所指定的盘符存在,2.使用file= 接收 fp=open('D:/text.txt','a+') print('hellowor 阅读全文
posted @ 2021-11-21 10:48 从精通到陌生 阅读(41) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 17 下一页