首页 > 编程语言 >基于Python+Flask实现宿舍管理系统

基于Python+Flask实现宿舍管理系统

时间:2024-08-16 20:22:50浏览次数:13  
标签:__ req fangkedengji Python 管理系统 Flask code dict msg

作者主页:编程千纸鹤

作者简介:Java领域优质创作者、CSDN博客专家 、CSDN内容合伙人、掘金特邀作者、阿里云博客专家、51CTO特邀作者、多年架构师设计经验、多年校企合作经验,被多个学校常年聘为校外企业导师,指导学生毕业设计并参与学生毕业答辩指导,有较为丰富的相关经验。期待与各位高校教师、企业讲师以及同行交流合作

主要内容:Java项目、Python项目、前端项目、PHP、ASP.NET、人工智能与大数据、单片机开发、物联网设计与开发设计、简历模板、学习资料、面试题库、技术互助、就业指导等

业务范围:免费功能设计、开题报告、任务书、中期检查PPT、系统功能实现、代码编写、论文编写和辅导、论文降重、长期答辩答疑辅导、腾讯会议一对一专业讲解辅导答辩、模拟答辩演练、和理解代码逻辑思路等

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-Python-048

一,环境介绍

语言环境:Python3.8

数据库:Mysql: mysql5.7

WEB框架:Django

开发工具:IDEA或PyCharm

二,项目简介

基于Python和Flask实现的宿舍管理系统是一个旨在提升宿舍管理效率和便捷性的Web应用。该系统利用Flask框架快速构建后端服务,提供RESTful API接口,支持用户登录、宿舍信息管理、学生入住与退宿记录、物品报修及维修跟踪、安全巡查记录等功能。前端可以采用Vue+HTML/CSS/JavaScript进行界面设计,与后端通过AJAX等技术实现数据交互,提供友好的用户操作界面。

系统核心在于数据库设计,需合理构建宿舍、学生、管理员、报修记录等数据表,并通过SQLAlchemy等ORM工具简化数据库操作。安全性方面,通过用户认证与授权机制保护数据安全,如使用JWT进行用户身份验证。此外,系统还应具备可扩展性和可维护性,便于未来功能升级和故障排查。

整体而言,该宿舍管理系统通过自动化管理流程,减轻了宿管人员的工作负担,提高了宿舍管理的透明度和效率,为学生提供了更加便捷和舒适的生活环境。

三,系统展示

学生角色功能

四,核心代码展示

# coding:utf-8
__author__ = "ila"

import logging, os, xlrd
from flask import request, jsonify,session
from sqlalchemy.sql import func,and_,or_
from api.models.brush_model import *
from . import main_bp
from utils.codes import *
from utils.jwt_auth import Auth
from configs import configs
from utils.helper import *
import random
import smtplib
from email.mime.text import MIMEText
from email.header import Header


# 注册接口
@main_bp.route("/python90kns/fangkedengji/register", methods=['POST'])
def python90kns_fangkedengji_register():
    if request.method == 'POST':
        msg = {'code': normal_code, 'message': 'success', 'data': [{}]}
        req_dict = session.get("req_dict")


        error = fangkedengji.createbyreq(fangkedengji, fangkedengji, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = "注册用户已存在"
        return jsonify(msg)

# 登录接口
@main_bp.route("/python90kns/fangkedengji/login", methods=['GET','POST'])
def python90kns_fangkedengji_login():
    if request.method == 'GET' or request.method == 'POST':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")
        req_model = session.get("req_dict")
        try:
            del req_model['role']
        except:
            pass


        datas = fangkedengji.getbyparams(fangkedengji, fangkedengji, req_model)
        if not datas:
            msg['code'] = password_error_code
            msg['msg']='密码错误或用户不存在'
            return jsonify(msg)


        req_dict['id'] = datas[0].get('id')
        return Auth.authenticate(Auth, fangkedengji, req_dict)

# 登出接口
@main_bp.route("/python90kns/fangkedengji/logout", methods=['POST'])
def python90kns_fangkedengji_logout():
    if request.method == 'POST':
        msg = {
            "msg": "退出成功",
            "code": 0
        }
        req_dict = session.get("req_dict")

        return jsonify(msg)

# 重置密码接口
@main_bp.route("/python90kns/fangkedengji/resetPass", methods=['POST'])
def python90kns_fangkedengji_resetpass():
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success"}

        req_dict = session.get("req_dict")

        if req_dict.get('mima') != None:
            req_dict['mima'] = '123456'

        error = fangkedengji.updatebyparams(fangkedengji, fangkedengji, req_dict)

        if error != None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        else:
            msg['msg'] = '密码已重置为:123456'
        return jsonify(msg)

# 获取会话信息接口
@main_bp.route("/python90kns/fangkedengji/session", methods=['GET'])
def python90kns_fangkedengji_session():
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "data": {}}
        req_dict={"id":session.get('params').get("id")}
        msg['data']  = fangkedengji.getbyparams(fangkedengji, fangkedengji, req_dict)[0]

        return jsonify(msg)

# 分类接口(后端)
@main_bp.route("/python90kns/fangkedengji/page", methods=['GET'])
def python90kns_fangkedengji_page():
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success",  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = session.get("req_dict")
        userinfo = session.get("params")

        try:
            __hasMessage__=fangkedengji.__hasMessage__
        except:
            __hasMessage__=None
        if __hasMessage__ and __hasMessage__!="否":
            tablename=session.get("tablename")
            if tablename!="users" and session.get("params")!=None and fangkedengji!='chat':
                req_dict["userid"]=session.get("params").get("id")

        tablename=session.get("tablename")
        if tablename=="users" :
            try:
                pass
            except:
                pass
        else:
            mapping_str_to_object = {}
            for model in Base_model._decl_class_registry.values():
                if hasattr(model, '__tablename__'):
                    mapping_str_to_object[model.__tablename__] = model

            try:
                __isAdmin__=mapping_str_to_object[tablename].__isAdmin__
            except:
                __isAdmin__=None

            if __isAdmin__!="是" and session.get("params")!=None:
                req_dict["userid"]=session.get("params").get("id")
            else:
                try:
                    del req_dict["userid"]
                except:
                    pass

        tablename = session.get("tablename")
        if tablename == 'xuesheng':
            req_dict['xueshengxuehao'] = userinfo['xueshengxuehao']
            if 'userid' in req_dict.keys():
                del req_dict["userid"]

        clause_args = []
        or_clauses = or_(*clause_args)

        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  = fangkedengji.page(fangkedengji, fangkedengji, req_dict, or_clauses)

        return jsonify(msg)

# 排序接口
@main_bp.route("/python90kns/fangkedengji/autoSort", methods=['GET'])
def python90kns_fangkedengji_autosort():
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success",  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = session.get("req_dict")
        req_dict['sort']='clicktime'
        req_dict['order']='desc'

        try:
            __browseClick__= fangkedengji.__browseClick__
        except:
            __browseClick__=None

        if __browseClick__ =='是':
            req_dict['sort']='clicknum'
        elif __browseClick__ =='时长':
            req_dict['sort']='browseduration'
        else:
            req_dict['sort']='clicktime'
        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  = fangkedengji.page(fangkedengji, fangkedengji, req_dict)

        return jsonify(msg)

# 分页接口(前端)
@main_bp.route("/python90kns/fangkedengji/list", methods=['GET'])
def python90kns_fangkedengji_list():
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success",  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = session.get("req_dict")
        if req_dict.__contains__('vipread'):
            del req_dict['vipread']
            
        userinfo = session.get("params")

        try:
            __foreEndList__=fangkedengji.__foreEndList__
        except:
            __foreEndList__=None

        if __foreEndList__ and __foreEndList__!="否":
            tablename=session.get("tablename")
            if tablename!="users" and session.get("params")!=None:
                req_dict['userid']=session.get("params").get("id")

        try:
            __foreEndListAuth__=fangkedengji.__foreEndListAuth__
        except:
            __foreEndListAuth__=None

        if __foreEndListAuth__ and __foreEndListAuth__!="否":
            tablename=session.get("tablename")
            if tablename!="users" and session.get("params")!=None:
                req_dict['userid']=session.get("params").get("id")

        tablename=session.get("tablename")
        if tablename=="users" :
            try:
                del req_dict["userid"]
            except:
                pass
        else:
            mapping_str_to_object = {}
            for model in Base_model._decl_class_registry.values():
                if hasattr(model, '__tablename__'):
                    mapping_str_to_object[model.__tablename__] = model

            try:
                __isAdmin__=mapping_str_to_object[tablename].__isAdmin__
            except:
                __isAdmin__=None

            if __isAdmin__!="是" and session.get("params")!=None:
                req_dict["userid"]=session.get("params").get("id")
            else:
                try:
                    del req_dict["userid"]
                except:
                    pass

        if 'luntan' in 'fangkedengji':
            if 'userid' in req_dict.keys():
                del req_dict["userid"]


        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  = fangkedengji.page(fangkedengji, fangkedengji, req_dict)

        return jsonify(msg)

# 保存接口(后端)
@main_bp.route("/python90kns/fangkedengji/save", methods=['POST'])
def python90kns_fangkedengji_save():
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")
        for key in req_dict:
            if req_dict[key] == '':
                req_dict[key] = None
        error= fangkedengji.createbyreq(fangkedengji, fangkedengji, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return jsonify(msg)

# 添加接口(前端)
@main_bp.route("/python90kns/fangkedengji/add", methods=['POST'])
def python90kns_fangkedengji_add():
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")
        try:
            __foreEndListAuth__=fangkedengji.__foreEndListAuth__
        except:
            __foreEndListAuth__=None

        if __foreEndListAuth__ and __foreEndListAuth__!="否":
            tablename=session.get("tablename")
            if tablename!="users":
                req_dict['userid']=session.get("params").get("id")
            
        error= fangkedengji.createbyreq(fangkedengji, fangkedengji, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return jsonify(msg)

# 踩、赞接口
@main_bp.route("/python90kns/fangkedengji/thumbsup/<id_>", methods=['GET'])
def python90kns_fangkedengji_thumbsup(id_):
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")
        id_=int(id_)
        type_=int(req_dict.get("type",0))
        rets=fangkedengji.getbyid(fangkedengji, fangkedengji,id_)

        update_dict={
        "id":id_,
        }
        if type_==1:#赞
            update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1
        elif type_==2:#踩
            update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1
        error = fangkedengji.updatebyparams(fangkedengji, fangkedengji, update_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return jsonify(msg)

# 获取详情信息(后端)
@main_bp.route("/python90kns/fangkedengji/info/<id_>", methods=['GET'])
def python90kns_fangkedengji_info(id_):
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}

        data = fangkedengji.getbyid(fangkedengji, fangkedengji, int(id_))
        if len(data)>0:
            msg['data']=data[0]
        #浏览点击次数
        try:
            __browseClick__= fangkedengji.__browseClick__
        except:
            __browseClick__=None

        if __browseClick__  and  "clicknum"  in fangkedengji.__table__.columns:
            click_dict={"id":int(id_),"clicknum":str(int(data[0].get("clicknum") or 0)+1)}
            ret=fangkedengji.updatebyparams(fangkedengji,fangkedengji,click_dict)
            if ret!=None:
                msg['code'] = crud_error_code
                msg['msg'] = ret
        return jsonify(msg)

# 获取详情信息(前端)
@main_bp.route("/python90kns/fangkedengji/detail/<id_>", methods=['GET'])
def python90kns_fangkedengji_detail(id_):
    '''
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}

        data = fangkedengji.getbyid(fangkedengji, fangkedengji, int(id_))
        if len(data)>0:
            msg['data']=data[0]

        #浏览点击次数
        try:
            __browseClick__= fangkedengji.__browseClick__
        except:
            __browseClick__=None

        if __browseClick__   and  "clicknum"  in fangkedengji.__table__.columns:
            click_dict={"id":int(id_),"clicknum":str(int(data[0].get("clicknum") or 0)+1)}
            ret=fangkedengji.updatebyparams(fangkedengji,fangkedengji,click_dict)
            if ret!=None:
                msg['code'] = crud_error_code
                msg['msg'] = ret
        return jsonify(msg)

# 更新接口
@main_bp.route("/python90kns/fangkedengji/update", methods=['POST'])
def python90kns_fangkedengji_update():
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")
        if req_dict.get("mima") and "mima" not in fangkedengji.__table__.columns :
            del req_dict["mima"]
        if req_dict.get("password") and "password" not in fangkedengji.__table__.columns :
            del req_dict["password"]
        try:
            del req_dict["clicknum"]
        except:
            pass


        error = fangkedengji.updatebyparams(fangkedengji, fangkedengji, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return jsonify(msg)

# 删除接口
@main_bp.route("/python90kns/fangkedengji/delete", methods=['POST'])
def python90kns_fangkedengji_delete():
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success", "data": {}}
        req_dict = session.get("req_dict")

        error=fangkedengji.delete(
            fangkedengji,
            req_dict
        )
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return jsonify(msg)

# 投票接口
@main_bp.route("/python90kns/fangkedengji/vote/<int:id_>", methods=['POST'])
def python90kns_fangkedengji_vote(id_):
    '''
    '''
    if request.method == 'POST':
        msg = {"code": normal_code, "msg": "success"}


        data= fangkedengji.getbyid(fangkedengji, fangkedengji, int(id_))
        for i in data:
            votenum=i.get('votenum')
            if votenum!=None:
                params={"id":int(id_),"votenum":votenum+1}
                error=fangkedengji.updatebyparams(fangkedengji,fangkedengji,params)
                if error!=None:
                    msg['code'] = crud_error_code
                    msg['msg'] = error
        return jsonify(msg)





# 分组统计接口
@main_bp.route("/python90kns/fangkedengji/group/<columnName>", methods=['GET'])
def python90kns_fangkedengji_group(columnName):
    '''
    分组统计接口
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}

        msg['data'] = fangkedengji.groupbycolumnname(fangkedengji,fangkedengji,columnName)
        return jsonify(msg)

# 按值统计接口
@main_bp.route("/python90kns/fangkedengji/value/<xColumnName>/<yColumnName>", methods=['GET'])
def python90kns_fangkedengji_value(xColumnName, yColumnName):
    '''
    按值统计接口,
    {
        "code": 0,
        "data": [
            {
                "total": 10.0,
                "shangpinleibie": "aa"
            },
            {
                "total": 20.0,
                "shangpinleibie": "bb"
            },
            {
                "total": 15.0,
                "shangpinleibie": "cc"
            }
        ]
    }
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}

        msg['data'] = fangkedengji.getvaluebyxycolumnname(fangkedengji,fangkedengji,xColumnName,yColumnName)
        return jsonify(msg)

# 按日期统计接口
@main_bp.route("/python90kns/fangkedengji/value/<xColumnName>/<yColumnName>/<timeStatType>", methods=['GET'])
def python90kns_fangkedengji_value_riqi(xColumnName, yColumnName, timeStatType):
    '''
    按日期统计接口
    '''
    if request.method == 'GET':
        msg = {"code": normal_code, "msg": "success", "data": {}}

        where = ' where 1 = 1 '

        sql = ''
        if timeStatType == '日':
            sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM fangkedengji {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, '%Y-%m-%d')

        if timeStatType == '月':
            sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM fangkedengji {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, '%Y-%m')

        if timeStatType == '年':
            sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM fangkedengji {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, '%Y')

        data = db.session.execute(sql)
        data = data.fetchall()
        results = []
        for i in range(len(data)):
            result = {
                xColumnName: decimalEncoder(data[i][0]),
                'total': decimalEncoder(data[i][1])
            }
            results.append(result)
            
        msg['data'] = results
        return jsonify(msg)

# 推荐算法接口
@main_bp.route("/python90kns/fangkedengji/autoSort2", methods=['GET'])
def python90kns_fangkedengji_autoSort2():
    if request.method == 'GET':

        leixing = set()
        req_dict = session.get("req_dict")
        userinfo = session.get("params")
        sql = "select inteltype from storeup where userid = "+userinfo.get("id")+" and tablename = 'fangkedengji' order by addtime desc"
        try:
            data = db.session.execute(sql)
            rows = data.fetchall()
            for row in rows:
                for item in row:
                    if item != None:
                        leixing.add(item)
        except:
            leixing = set()

        L = []
        sql ="select * from fangkedengji where $intelRecomColumn in ('%s"%("','").join(leixing)+"') union all select * from fangkedengji where $intelRecomColumn not in('%s"%("','").join(leixing)+"')"
        data = db.session.execute(sql)
        data_dict = [dict(zip(result.keys(), result)) for result in data.fetchall()]
        for online_dict in data_dict:
            for key in online_dict:
                if 'datetime.datetime' in str(type(online_dict[key])):
                    online_dict[key] = online_dict[key].strftime(
                        "%Y-%m-%d %H:%M:%S")
                else:
                    pass
            L.append(online_dict)

        return jsonify({"code": 0, "msg": '',  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":5,"list": L[0:6]}})





五,相关作品展示

基于Java开发、Python开发、PHP开发、C#开发等相关语言开发的实战项目

基于Nodejs、Vue等前端技术开发的前端实战项目

基于微信小程序和安卓APP应用开发的相关作品

基于51单片机等嵌入式物联网开发应用

基于各类算法实现的AI智能应用

基于大数据实现的各类数据管理和推荐系统

 

 

标签:__,req,fangkedengji,Python,管理系统,Flask,code,dict,msg
From: https://blog.csdn.net/BS009/article/details/141148275

相关文章

  • 基于Python爬虫实现招聘数据分析可视化大屏
    作者简介:Java领域优质创作者、CSDN博客专家、CSDN内容合伙人、掘金特邀作者、阿里云博客专家、51CTO特邀作者、多年架构师设计经验、多年校企合作经验,被多个学校常年聘为校外企业导师,指导学生毕业设计并参与学生毕业答辩指导,有较为丰富的相关经验。期待与各位高校教师、企业......
  • 快速排序算法详解及Python实现
    目录引言快速排序算法步骤快速排序的Python实现性能分析注意事项引言快速排序(QuickSort)是一种高效的排序算法,由C.A.R.Hoare在1960年提出。它的基本思想是:通过一趟排序将待排序的数据分割成独立的两部分,其中一部分的所有数据都比另一部分的所有数据要小,然后再按此......
  • python入门篇-day04-函数
    介绍概述函数也叫方法,可以用单词Function(函数,功能),Method(方法)来表示.函数=把具有独立功能的代码封装到一起,使其成为具有特殊功能的代码集.好处提到代码的复用性.模块化编程.格式def函数名(形式参数1,形参2...):  函数体,就是以前写的逻辑代......
  • python入门篇-day05-函数进阶
    函数返回多个值不管返回多少都会默认封装成一个元组的形式返回(可以自定义返回的数据类型,如:[]{})思考:1个函数可以同时返回多个结果(返回值)?答案:错误,因为1个函数只能返回1个结果,如果同时返回多个值则会封装成1个元素进行返回.演示#需求:定义函数my_cal......
  • 基于flask+vue框架的的校园后台报修管理系统设计与实现[开题+论文+程序]-计算机毕设
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表开题报告内容研究背景随着校园信息化建设的不断深入,各类基础设施的维护与保养成为保障教学、科研及师生生活顺利进行的重要环节。然而,传统的报修方式往往依赖于......
  • 基于flask+vue框架的基于Android的大学校园车辆管理系统统后[开题+论文+程序]-计算机
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表开题报告内容研究背景随着大学校园规模的不断扩大与师生数量的激增,校园内的车辆管理问题日益凸显。传统的人工管理方式不仅效率低下,难以满足高峰时段的车辆进出......
  • 基于flask+vue框架的高校日常办公管理系统设计与实现[开题+论文+程序]-计算机毕设
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表开题报告内容研究背景随着高校规模的不断扩大与教育信息化的深入发展,高校日常办公管理面临着前所未有的挑战。传统的手工或半自动化管理方式已难以满足日益增长......
  • 基于flask+vue框架的大学生成绩管理系统[开题+论文+程序]-计算机毕设
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表开题报告内容研究背景随着高等教育的普及与信息化技术的飞速发展,大学生成绩管理成为高校教务管理中至关重要的一环。传统的手工成绩记录与管理方式不仅效率低下......
  • Python教程(十五):IO 编程
    目录专栏列表引言基础概念什么是IO?同步IOvs异步IO同步IO(SynchronousIO)异步IO(AsynchronousIO)Python中的IO标准IO标准输入和输出文件IO文件操作的上下文管理器打开文件读取文件操作内存中的数据高级文件操作读写二进制文件使用文件指针网络IO使用`requests`库使用......
  • python自学
    基础语法字面量定义:在代码中,被写下来的值,称之为字面量类型:python中常用的有6种数据类型数字整数(int)浮点数(float)复数(complex),如4+3j布尔(bool):True本质为1,False本质为0字符串(String)字符串需要使用'xxx',"xxx"或者'''xxx'''格式,而三引号中的字符串可以跨行。......