会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133509个问题
JAVA 全系列/第六阶段:JavaWeb开发/Ajax技术详解(旧) 13666楼
JAVA 全系列/第六阶段:JavaWeb开发/Ajax技术详解(旧) 13667楼

image.png

JAVA 全系列/第六阶段:JavaWeb开发/Ajax技术详解(旧) 13668楼
Python 全系列/下架-第十二阶段:Python_大型电商项目(5天后下架)/Django项目阶段-电商项目(旧) 13669楼
Python 全系列/下架-第十二阶段:Python_大型电商项目(5天后下架)/Django项目阶段-电商项目(旧) 13670楼
WEB前端全系列/第二阶段:JavaScript编程模块/浏览器模型(BOM) 13671楼

import turtle

a=input("请输入一个x:")
b=input("请输入一个y:")
c=input("请输入一个width:")
d=input("请输入一个height:")

class MyRectangle:

    def __init__(self,x,y,width,height):


        self.x=x
        self.y=y
        self.width=width
        self.height=height

        if self.x=="":
            self.x=0

        if self.x!="":
            self.x=float(x)

        if self.y=="":
            self.y=0

        if self.y!="":
            self.y=float(y)

        if self.width == "":
            self.width = 100

        if self.width!="":
            self.width=float(width)

        if self.height == "":
            self.height = 100

        if self.height!="":
            self.height=float(height)

    def getArea(self):
        return self.width*self.height

    def getPerimeter(self):
        return 2*(self.height+self.width)

    def draw(self):
        turtle.color("red")
        turtle.penup()
        turtle.goto(self.x,self.y)
        turtle.pendown()
        turtle.right(90)
        turtle.forward(self.width)
        turtle.right(90)
        turtle.forward(self.height)
        turtle.right(90)
        turtle.forward(self.width)
        turtle.right(90)
        turtle.forward(self.height)
        turtle.done



m1=MyRectangle(a,b,c,d)
print(m1.getArea())
print(m1.getPerimeter())
m1.draw()

老师,为什么我在调用draw方法的之后海龟作图不显示?

Python 全系列/第一阶段:Python入门/面向对象 13672楼

vue_shop.zip

Flask百战后台项目.zip


老师我这个跨域已经设置了,总是显示500错误,麻烦老师帮我看看

Python 全系列/第九阶段:Flask百战电商后台系统/Flask百战电商后台项目 13673楼
JAVA 全系列/第六阶段:JavaWeb开发/Servlet技术详解(旧) 13674楼
JAVA 全系列/第一阶段:AI驱动的JAVA编程/面向对象详解和JVM底层内存分析 13677楼
Python 全系列/第二阶段:Python 深入与提高/异常机制 13678楼

package com.liu.jdbc;

import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.List;

public class PreparedStatementTest4 {
    public static void main(String[] args) throws Exception{
        String sql="select id from scott.users_info where id<?";
        List<Users> u=queryList(sql,5);
        System.out.println();
    }
    public static List<Users> queryList(String sql,Object...args) throws Exception{
        Connection conn=JdbcUtils.getConnection();
        PreparedStatement ps=conn.prepareStatement(sql);
        for(int i=0;i< args.length;i++){
            ps.setObject(i+1,args[i]);
        }
        List<Users> users=new ArrayList<>();
        ResultSet rs=ps.executeQuery();
        ResultSetMetaData rsmd=ps.getMetaData();
        int columnCnt=rsmd.getColumnCount();
        while (rs.next()){
            Users u=new Users();
            for (int i=0;i<columnCnt;i++){
                Object value=rs.getObject(i+1);
                System.out.println(value);
                String columnName=rsmd.getColumnName(i+1).toLowerCase();
                Field field=u.getClass().getDeclaredField(columnName);
                System.out.println(columnName);
                field.setAccessible(true);
                field.set(u,value);
            }
            users.add(u);
        }
        JdbcUtils.close(conn,ps);
        rs.close();
        return users;
    }
}

我连接的是oracle数据库,为什么对id赋值会报这个错误呢?String类型的就没问题1642413962(1).jpg

JAVA 全系列/第四阶段:数据库与AI协同技术实战/JDBC技术(旧) 13679楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/多线程技术(旧) 13680楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637