import random number = random.randint(1,100) while True: inputnumber = int(input("请输入你心中的数字:")) if inputnumber == number: print("答对了") break elif inputnumber > number: print("大了大了") elif inputnumber < number: print(&quo…
题目: 1.比如说,我想    “我喜欢月月”  这句话加密即:将字符串中的每个字符的unicode值全都向后移动三位,即unicode 值加3,然后输出. 2.将按照上述规则加密的文字解密即:将字符串中的每个字符的unicode值全都向前减三. #caesarencode programme while True: txt = input("please type you word:") for i in txt: if "a" <= i <=&quo…
#需要的一小段文本 txt = "人生得意须尽欢,莫使金樽空对月.天生我才必有用,千金散尽还复来." #对文本进行分割,转换成列表形式 def txt_split(txt): li = [",","."] for i in li: #最关键的是下面这句,txt的名字要一致,将replace返回的副本重新赋值给TXT txt = txt.replace(i,"\n") txt = txt.split("\n"…
with open(r"C:\Users\mike1\Desktop\practice_txt.txt","r",encoding = "gbk") as txt1, \ open(r"C:\Users\mike1\Desktop\result_txt.txt", "w", encoding = "gbk" ) as txt2: empty_dic = {} file1 = txt1.r…
题目:使用turtle库的turtle.forward(),turtle.left(),函数绘制一个六边形,边长为100 像素 import turtle for i in range(6): turtle.left(60) turtle.forward(100) 题目2    :   深度为7 的满二叉树,其节点的个数是多少? 根据等比数列求和公式: 为2的n次方减1个节点.…
用turtle画一个正方形 import turtle turtle.penup() turtle.goto(-100,-100) turtle.pendown() turtle.begin_fill() turtle.color("blue","green") for i in range(4):     turtle.forward(200)         turtle.left(90)       turtle.end_fill() turtle.penco…
基础篇2:一切变量都是数据对象的引用sys.getrefcount('test') 查看引用计数变量命名不能以数字开头编码:ascii.unicode.utf-81.阅读str对象的help文档,并解决如下的问题.1.1.有如下字符串. python是动态语言 要求如下[请分别写出脚本]: a=' python是动态语言 '(1.)去掉该字符串下前面所有的空格. print a.lstrip() (2.)去掉该字符串下后面所有的空格. print a.rstrip() (3.)去掉该字符串2边的…
0.引言 介绍了如何生成数据,提取特征,利用sklearn的几种机器学习模型建模,进行手写体数字1-9识别. 用到的四种模型: 1. LR回归模型,Logistic Regression 2. SGD随机梯度下降模型,Stochastic Gradient Descent 3. SVC支持向量分类模型,Support Vector Classification 4. MLP多层神经网络模型,Multi-Layer Perceptron 主要内容:生成手写体随机数1-9,生成单个png分类存入指定…
思路 先找到控件id ,这样就可以监听change事件 然后把自己写的js加入xadmin中 添加url和view,接受ajax请求和发送数据 第一步:找到联动上下级的ID 在浏览器中通过F12查看 父级ID:id_files_category1 子级id:id_files_categoty2 第二步:ajax请求 $('#id_files_category1').change(function () { var module = $('#id_files_category1').find('o…
0.引言 介绍了如何生成手写体数字的数据,提取特征,借助 sklearn 机器学习模型建模,进行识别手写体数字 1-9 模型的建立和测试. 用到的几种模型: 1. LR,Logistic Regression, (线性模型)中的逻辑斯特回归 2. Linear SVC,Support Vector Classification, (支持向量机)中的线性支持向量分类  3. MLPC,Multi-Layer Perceptron Classification,    (神经网络)多层感知机分类 4…