from flask import Flask,url_for app = Flask(__name__) @app.route('/') def hello_world(): #和请求相关的操作就必须应用到请求上下文,比如使用url_for反转视图函数,构建url=/mylist/ print(url_for('mylist')) return 'Hello World!' # print(url_for('mylist')) # with app.app_context(): # 开启应用上下文 # print(url_for('mylist')) with app.test_request_context(): # 开启请求上下文 print(url_for('mylist')) @app.route('/mylist/') def mylist(): return "我的列表" if __name__ == '__main__': app.run(debug=True)
老师,我这里开启了请求上下文with app.test_request_context(),但是运行报错。
老师,我在这里锁的时候锁属性也可以,也就是说锁什么都行了?在使用的时候有没有什么要注意的地方呀?
标签的大小 是根据字体动态调整的吗,开始定义的width,height 不起作用?
老师:请提供一下solr8.2.0版本的安装包,173兆官网下载太慢了。谢谢
老师您好,我刚看到有其他学生和我有一样的疑惑,但是那个老师回答的意思像是rest();是必写在子类里才能执行。
但是我没在子类里写这个也能正常执行,请问是我哪里理解错了呢?下面是我的代码
package com.itbaizhan.oop; /** * 测试继承 */ public class TestExtends { public static void main(String[] args) { Student s1 = new Student("Lia",158,"英语"); System.out.println(s1 instanceof Student); System.out.println(s1 instanceof Person); s1.rest(); } } class Person /*extends Object*/ { String name; int height; public void rest() { System.out.println("休息!"); } } class Student extends Person { String major; //专业 public void study() { System.out.println("学习!"); System.out.println(this.name); } public Student(String name, int height, String major) { this.name = name; this.height = height; this.major = major; } }
""" 1、项目中有哪些类 2,、每个类中有哪些方法 1.坦克类 射击 移动 显示坦克的方法 2.子弹类 移动 显示子弹方法 3.墙壁类 属性:是否可以通过 4.爆炸效果类 展示爆炸效果 5.音效类 播放音乐 6.主类 开始游戏 结束游戏 """ """ 新增功能 :加载主窗口 """ import pygame SCREEN_WIDTH=700 SCREEN_HEIGHT=500 class MainGame(): window=None def __init__(self): pass #开始游戏 def startGame(self): # 初始化显示模块 pygame.display.init() #设置窗口大小及显示 MainGame.window=pygame.display.set_mode([SCREEN_WIDTH,SCREEN_HEIGHT]) while True: pygame.dislay.update def endGame(self): pass class Tank(): def __init__(self): pass #移动 def move(self): pass #射击 def shot(self): pass #展示坦克方法 def displayTank(self): pass #我放坦克 class MyTank(Tank): def __init__(self): pass #敌方坦克 class EnemyTank(Tank): def __init__(self): pass #子弹类 class Bullet(): def __init__(self): pass #移动 def move(self): pass #展示子弹的方法 def displayBullet(self): pass class Wall(): def __init__(self): pass #展示墙壁额方法 def displayWall(self): pass class Explode(): def __init__(self): pass def displayExlode(self): pass class Music(): def __init__(self): pass def play(self): pass if __name__=='__main__': MainGame().startGame()
href里面必须是单引号什么意思?编辑器里面自动补全是
<a href=""></a>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> .top{ width: 100%; height: 50px; background: url(img/IMG_20190820_082424.jpg) repeat scroll top left; } .center{ width: 100%; height: 200px; background-color:beige; } .down{ width: 100%; height: 50px; background-color: blueviolet; } .center_1{ width: 100px; height: 100px; background: brown; position: relative; left: 450px; top: 10px; } .center_2{ width: 100px; height: 200px; background: black; } </style> </head> <body> <div class="top"> <a href="http://www.baidu.com"> 简介</a> </div> <div class="center"> <div class="center_2"></div> <div class="center_1"></div> </div> <div class="down"> </div> </body> </html>
如何将中间两个叠加对齐?
老师 我的一直报这个错 链接:https://pan.baidu.com/s/13AwEVC8ssZulsZlFE1dgVQ 密码:vhr6
这个怎么感觉跟DataOutputStream没啥区别?都能写int,char,UTF啥的
老师,我不明白为什么title的类型为字符串呢,其他的都为对象。
<div id="d" style="width: 100px;height: 100px;background: red">文本</div>
<script> var t=document.getElementById("d"); console.log(typeof(t)); console.log(typeof(document.title)); console.log(typeof(document.head)); console.log(typeof(document.body)); </script>
老师能不能提交其他资料的时候将软件工具的文件给线上也提交一下,不然下载太慢了
关于3,a b 中两个原本不合法,但在提问中,同学发现合法的代码,
3 a 中 ename是显示不同job组中,第一个人的name吗?
3 b 中 empno的结果,是所有empno的数字相加吗?
老师,是不是我那个地方写错了
package com.bjsxt.thread.prosumer2; /** * <p>Title: TestConsumer</p> * <p>Description: 消费者模式</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestConsumer implements Runnable{ //功能属性 private TestSupermarket supermarket; //超市 //构造方法 public TestConsumer(TestSupermarket supermarket) { this.supermarket = supermarket; } //定义线程体 @Override public void run() { for (int i = 0;i<10;i++) { supermarket.getConsumer(); } } } package com.bjsxt.thread.prosumer2; /** * <p>Title: TestProducer</p> * <p>Description: 生产者模式</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestProducer implements Runnable{ //功能属性 private TestSupermarket supermarket; //超市 //构造方法 public TestProducer(TestSupermarket supermarket) { this.supermarket = supermarket; } //定义线程体 @Override public void run() { for (int i = 0;i<10;i++) { if (i % 2 != 0) { supermarket.setProducer("旺仔","小馒头"); }else { supermarket.setProducer("康师傅","红烧牛肉面"); } } } } package com.bjsxt.thread.prosumer2; /** * <p>Title: TestSupermarket</p> * <p>Description: 超市(存储)</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestSupermarket { // 功能属性 private String brand; //品牌 private String name; //名称 //构造方法 public TestSupermarket() {} public TestSupermarket(String brand,String name) { this.brand = brand; this.name = name; } //get、set public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getName() { return name; } public void setName(String name) { this.name = name; } //定义同步方法Producer public synchronized void setProducer(String brand,String name) { this.setBrand(brand); try { Thread.sleep(300); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setName(name); System.out.println("生产者生产了:" + this.getBrand() + this.getName()); } public synchronized void getConsumer() { System.out.println("消费者消费了:" + this.getBrand() + this.getName()); } }
测试结果:
方法区中加载的类也有内存地址吧?与new出的对象的内存地址不一样吧?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637