摘要:
# 条件真假情况如下: # 布尔类型:True为真,False为假 # 对于数字:0或0.0当作假,其它为真 # 对于其它类型,对象为空时为假,其它情况为真,比如:""空字符串、[]空列表、()空元组、{}空字典、None空值。 # pass语句,让解释器跳过此处,什么都不做 a = 10 if 1 阅读全文
posted @ 2024-05-10 00:24
jason8826
阅读(31)
评论(0)
推荐(0)
摘要:
# 字符串拼接 print("11"+"22") # str()和repr()的区别 str1 = "123456" s_str = str(str1) s_repr = repr(str1) print("str: ", s_str) # str()保留了字符串最原始的样子 print("repr 阅读全文
posted @ 2024-05-10 00:23
jason8826
阅读(34)
评论(0)
推荐(0)
摘要:
# 切片操作会生成一个新的序列(而不是提取原先序列的元素) # 创建空列表 list1 = [] # 或 list1 = list() print(list1) # 列表添加元素 # l.append(x) 相当于l[len(l):] = [x] list1.append("12345") prin 阅读全文
posted @ 2024-05-10 00:23
jason8826
阅读(20)
评论(0)
推荐(0)
摘要:
import decimal import time print("1\n" "2", 1) print("""adf""") print('''adf''') print("1111111111111111" "222222222222" "33333333333333333" ) # 高精度 a 阅读全文
posted @ 2024-05-10 00:22
jason8826
阅读(18)
评论(0)
推荐(0)
浙公网安备 33010602011771号