#1-100所有数累加的和,偶数和及奇数和 num = 0 num_all = 0 num_odd = 0 num_even = 0 while num <=100: num_all += num num += 1 if num%2 == 1: #对2取余,判断奇偶数 num_odd += num else: num_even += num print('1-100累加和{0},1-100奇数和{1},1-100偶数和{2}'.format(num_all,num_odd,num_even)) 运行结果:1-100累加和5050,1-100奇数和2601,1-100偶数和2550
请问老师,为什么我这样算出来奇数和是多了100呢?哪里有问题
老师,我想问一下,比如turtle.color('red')和print(a),这两个小括号之间一个有引号一个没有 那这个是有什么规定什么时候用什么时候不用吗
from fake_useragent import UserAgent import ssl import requests from lxml import etree from time import sleep def get_html(url): ''' :param url: 要爬取的地址 :return: 返回html ''' headers = {"User_Agent": UserAgent().random} resp = requests.get(url,headers=headers) #status_code 返回状态码 if resp.status_code == 200: resp.encoding='utf-8' return resp.text else: return None def parse_list(html): ''' :param html: 传递进来有一个电影列表的的html :return: 返回一个电影的url ''' e = etree.HTML(html) # 解决验证CA # ssl._create_default_https_context = ssl._create_unverified_context list_url = ['https://www.qidian.com{}'.format(url)for url in e.xpath('//div[@class="book-img-box"]/a/@href')] return list_url def parse_index(html): ''' :param html: 传递一个有电影信息的html :return: 已经提取好的电影信息 ''' e = etree.HTML(html) name = e.xpath('//div/h1/span/a/text()') return name def main(): num = int(input("请输入要获取多少页:")) for page in range(num): url = 'https://www.qidian.com/all?&page={}'.format(page+1) list_html = get_html(url) list_url = parse_list(list_html) for url in list_url: info_html = get_html(url) move = parse_index(info_html) print(move) if __name__ == '__main__': main()
老师,您帮我看一下,为什么我这个最后返回的是空列表啊,我debug看了一下是这个出问题了。返回了空值,但是我使用插件看了看没问题啊
name = e.xpath('//div/h1/span/a/text()')
请问下 print(f‘(门开着。。。{}号人进入))里的f是什么意思
老师,这么写跟老师视频中的代码一模一样,这个报错看不明白。 我用面向对象直接创建2个类功能也可以实现。 视频中的判断是不是如果i==偶数的话就显示蓝色,否则就显示白色。 borderwidth=1这是是边框间距嘛? relief='solid' 这个是3D显示效果嘛? 抱歉,英文水平不好。
老师,我将Xshell关了之后再打开的时候,执行./mongo命令时,报这个错误是什么原因?
x={x x () x%==} (x)
{99, 36, 72, 9, 45, 81, 18, 54, 90, 27, 63}
老师,想问一下,集合推导式问什么跑出来的数不是按顺序的呀?
老师为什么我自己敲的结果和老师的不一样,我的只是调用了一回方法啊
老师为吗这把所有的都打印出来了,我只是用了最后一个啊!!
老师,这个@RequestBody具体是上面意思,视频里没听懂
老师,第二个ip要怎么设置啊,随便设置吗
AttributeError: module 'time' has no attribute 'clock'
为什么会有这样的报错?
Button(name='earsor')中的name是做什么的
老师,帮忙看一下这个报错
"C:\Program Files\Java\jdk-16\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:D:\Toolbox\apps\IDEA-U\ch-0\203.7148.57\lib\idea_rt.jar=62520:D:\Toolbox\apps\IDEA-U\ch-0\203.7148.57\bin -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=GBK -classpath D:\Java_Code\SpringbootMybatis\target\classes;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\2.4.4\spring-boot-starter-thymeleaf-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter\2.4.4\spring-boot-starter-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot\2.4.4\spring-boot-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.4.4\spring-boot-autoconfigure-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.4.4\spring-boot-starter-logging-2.4.4.jar;C:\Users\Mr.G\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\Mr.G\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\Mr.G\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;C:\Users\Mr.G\.m2\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;C:\Users\Mr.G\.m2\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\Mr.G\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\Mr.G\.m2\repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;C:\Users\Mr.G\.m2\repository\org\thymeleaf\thymeleaf-spring5\3.0.12.RELEASE\thymeleaf-spring5-3.0.12.RELEASE.jar;C:\Users\Mr.G\.m2\repository\org\thymeleaf\thymeleaf\3.0.12.RELEASE\thymeleaf-3.0.12.RELEASE.jar;C:\Users\Mr.G\.m2\repository\org\attoparser\attoparser\2.0.5.RELEASE\attoparser-2.0.5.RELEASE.jar;C:\Users\Mr.G\.m2\repository\org\unbescape\unbescape\1.1.6.RELEASE\unbescape-1.1.6.RELEASE.jar;C:\Users\Mr.G\.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;C:\Users\Mr.G\.m2\repository\org\thymeleaf\extras\thymeleaf-extras-java8time\3.0.4.RELEASE\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.4.4\spring-boot-starter-web-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.4.4\spring-boot-starter-json-2.4.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;C:\Users\Mr.G\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.4.4\spring-boot-starter-tomcat-2.4.4.jar;C:\Users\Mr.G\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.44\tomcat-embed-core-9.0.44.jar;C:\Users\Mr.G\.m2\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;C:\Users\Mr.G\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.44\tomcat-embed-websocket-9.0.44.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-web\5.3.5\spring-web-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-beans\5.3.5\spring-beans-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-webmvc\5.3.5\spring-webmvc-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-aop\5.3.5\spring-aop-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-context\5.3.5\spring-context-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-expression\5.3.5\spring-expression-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.1.4\mybatis-spring-boot-starter-2.1.4.jar;C:\Users\Mr.G\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.4.4\spring-boot-starter-jdbc-2.4.4.jar;C:\Users\Mr.G\.m2\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-jdbc\5.3.5\spring-jdbc-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-tx\5.3.5\spring-tx-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.1.4\mybatis-spring-boot-autoconfigure-2.1.4.jar;C:\Users\Mr.G\.m2\repository\org\mybatis\mybatis\3.5.6\mybatis-3.5.6.jar;C:\Users\Mr.G\.m2\repository\org\mybatis\mybatis-spring\2.0.6\mybatis-spring-2.0.6.jar;C:\Users\Mr.G\.m2\repository\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar;C:\Users\Mr.G\.m2\repository\com\alibaba\druid\1.1.12\druid-1.1.12.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-core\5.3.5\spring-core-5.3.5.jar;C:\Users\Mr.G\.m2\repository\org\springframework\spring-jcl\5.3.5\spring-jcl-5.3.5.jar com.bjsxt.springbootmybatis.SpringbootmybatisApplication Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.4.4) 2021-04-01 14:37:40.509 INFO 13944 --- [ main] c.b.s.SpringbootmybatisApplication : Starting SpringbootmybatisApplication using Java 16 on LAPTOP-SSNOOCN5 with PID 13944 (D:\Java_Code\SpringbootMybatis\target\classes started by Mr.G in D:\java_code) 2021-04-01 14:37:40.512 INFO 13944 --- [ main] c.b.s.SpringbootmybatisApplication : No active profile set, falling back to default profiles: default 2021-04-01 14:37:40.933 WARN 13944 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.bjsxt.springbootmybatis.mapper]' package. Please check your configuration. 2021-04-01 14:37:41.152 INFO 13944 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2021-04-01 14:37:41.157 INFO 13944 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-04-01 14:37:41.158 INFO 13944 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.44] 2021-04-01 14:37:41.230 INFO 13944 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-04-01 14:37:41.230 INFO 13944 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 674 ms 2021-04-01 14:37:41.260 WARN 13944 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usersController': Unsatisfied dependency expressed through field 'usersService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'usersMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.bjsxt.mapper.UsersMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2021-04-01 14:37:41.261 INFO 13944 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2021-04-01 14:37:41.269 WARN 13944 --- [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.base@16/java.lang.Object.wait(Native Method) java.base@16/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) app//com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43) 2021-04-01 14:37:41.274 INFO 13944 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-04-01 14:37:41.286 ERROR 13944 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Field usersMapper in com.bjsxt.springbootmybatis.service.impl.UserServiceImpl required a bean of type 'com.bjsxt.mapper.UsersMapper' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.bjsxt.mapper.UsersMapper' in your configuration. Process finished with exit code 1
Java_Code.rar
一、问题
Springboot中SpringSession的失效时间为什么在启动类中使用注解属性来配置,如果提取到yml文件中不是很方便吗
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637