burpow
Python3 自带模块

Python3 自带模块

random模块

函数名 功能
random() 生成0~1随机小数
randint(num1,num2) 生成包含端点的整数
choice(seq) 序列内随机选一个元素
shuffle(seq) 对序列随机排序

calendar模块

1
2
3
4
5
6
7
8
9
10
# 引入日历模块
import calendar

# 输入指定年月
yy = int(input("输入年份: "))
mm = int(input("输入月份: "))

# 显示日历,判断本月天数
print(calendar.month(yy,mm))
print(calendar.monthrange(2016,9))

re

本文作者:burpow
本文链接:https://youthfulnesszxx.github.io/2026/03/26/Python3 自带模块/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可