会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132884个问题
Python 全系列/第十四阶段:Python 爬虫开发/移动端爬虫开发- 7111楼
JAVA 全系列/第三阶段:数据库编程/Oracle 数据库的使用 7112楼
JAVA 全系列/(旧的隐藏)第七阶段:JAVA 高级技术/Dubbo 7115楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/网络编程(旧) 7117楼
JAVA 全系列/第一阶段:JAVA 快速入门/IDEA的使用和第一个java项目 7121楼

-------------------------------代码部分如下-----------------------------------

import math

import re


def inputdata(i) :

    # 输入第一个坐标点a

    x1, y1 = input("请输入第{}坐标点的x值和y值,以空格隔开:".format(i)).split()

    # 正则表达式判断是否为小数,若不为小数,则给出提示,重新输入

    float_data = re.compile(r'^[-+]?[0-9]+\.?[0-9]*$')

    x = float_data.match(x1)

    y = float_data.match(y1)

    # x,y坐标同时满足要求时返回值,否则重新输入

    if x and y :

        print(x1, y1)

        print(type(x1),type(y1)) # 是string类型

        return float(x1), float(y1)  # string类型转换成浮点型

    else :

        print("输入错误,请输入整数或浮点数")

        # return 0,0 

        inputdata(i)



# 获取第一个坐标点

ax, ay = inputdata(1)

# print(type(ax))

# 获取第二个坐标点

bx, by = inputdata(2)

# 获取第三个坐标点

cx, cy = inputdata(3)

# print(cx+cy)

# print(type(cx))

# 计算三条边长

a = math.sqrt(math.pow((ax - bx), 2) + math.pow((ay - by), 2))

b = math.sqrt(math.pow((bx - cx), 2) + math.pow((by - cy), 2))

c = math.sqrt(math.pow((ax - cx), 2) + math.pow((ay - cy), 2))

if a + b > c and a + c > b and b + c > a :

    # 海伦公式

    p = (a + b + c)

    print('p:', p, a, b, c)

    S = math.sqrt(p * (p - a) * (p - b) * (p - c))

    print("三角形面积为:%.2f" % S)

else :

    print("三角形不成立")


-----------------------------------------问题----------------------------------------

运算结果如下,为什么第二次输入错误的坐标,再按提示重新输入正确的坐标表后,返回值接受不到?

image.png


Python 全系列/第一阶段:Python入门/函数和内存分析 7122楼
JAVA 全系列/第五阶段:JavaWeb开发/Ajax技术详解(旧) 7124楼

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.bjsxt</groupId>
    <artifactId>nexusweb</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <distributionManagement>
        <repository>
            <!--需要与settings.xml 中server 的id 相同-->
            <id>releases</id>
            <name>Nexus Release Repository</name>
            <url>http://192.168.0.101:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <!--需要与settings.xml 中server 的id 相同-->
            <id>snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.0.101:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <path>/</path>
                    <port>8080</port>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

上传源码报如下错误

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project nexusweb: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

image.png


上传源码的时候报错 不知道什么情况 请老师指点下



JAVA 全系列/第八阶段:Linux入门到实战/Maven 7125楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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