- 博客(3)
- 收藏
- 关注
原创 Python学习笔记(2)——异常处理
基本使用 try: <语句块1> except<异常类型>:#当语句块1异常时 <语句块2> 高级使用 try: <<语句块1>> except<异常类型>:#当语句块1异常时 <<语句块2>> else:#当try能执行时 <语句块3> finally:#无论是否异常,一定执行 <语句块4> ...
2020-07-17 10:45:11
126
原创 Python学习笔记(1)—— Python字符串的常用处理方法(函数)
p.s “方法”特指 a.b() 风格中的函数 b() 1、str.upper()和str.lower() 功能:将字符串变为全大写或全小写 举例: >>> print('A1b2c3'.upper()) A1B2C3 >>> print('A1b2c3'.lower()) a1b2c3 2、str.split(sep) 功能:将字符串变为列表,字符串为sep分隔 举例: >>> 'A,b,c'.split() ['A,b,c'] >>&g
2020-07-15 16:32:04
150
原创 Python练习笔记(1)——用Python绘出斜三角形
用Python绘出斜三角形 temp=input("input a number:") num=int(temp) while num: i=num - 1 while i: print('',end = ' ') i = i - 1 j = num while j: print('*',end = '') j = j - 1 print() num = num - 1 效果 重点: ...
2020-07-13 11:44:01
564
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅