js ajax如何把返回的data赋值给Literal

前台js如下 求大神告知

  function aaa()
     {
         var id = $(".sd").attr("id");

         $.ajax({
             type: "POST",
             url: "/Handler1.ashx",
             data: { id: id },
             success: function (data) {
                 //document.getElementById('#Literal2')(data);
                 // document.getElementById("#Literal2").innerHTML = data
                 //  $("#Literal2").text=data;
             }
         });
    }

是不是js不能给服务器控件赋值? 如果在aspx的话 怎么把从一般处理程序返回来的data 传给aspx呢?

2个回答

Literal不生成html标签,客户端无法更新,用label,而且你jquery,原生js属性和方法都搞混了

 $('#xxx').html(xxxx)

document.getElementById('xxx').innerHTML=xxxx
qq_36165603
冷淡的胖子 抱歉 确实是ID变了 非常感谢你
接近 3 年之前 回复
qq_36165603
冷淡的胖子 浏览器中label被我添加的值取代了 所以找不到
接近 3 年之前 回复
showbo
支付宝加好友偷能量挖 回复qq_36165603: 自己查看浏览器中的源代码,检查id,确认进入success没更新肯定是id拼写错了
接近 3 年之前 回复
qq_36165603
冷淡的胖子 回复showbo: 只是这个页面使用了模板页 - - 也要这样吗?
接近 3 年之前 回复
showbo
支付宝加好友偷能量挖 回复qq_36165603: 放入母版中,你的这个js代码要一起放母版中,然后$('#<%=xxxxx.ClientID%>')才能得到正确的客户端id
接近 3 年之前 回复
qq_36165603
冷淡的胖子 回复showbo: 还加了runat="server"
接近 3 年之前 回复
qq_36165603
冷淡的胖子 回复showbo: 我使用了模板
接近 3 年之前 回复
showbo
支付宝加好友偷能量挖 回复qq_36165603: id拼写对了没有?是否放到其他容器里面了,如自定义ascx或者母版里面了,这样id是会改变的
接近 3 年之前 回复
qq_36165603
冷淡的胖子 按照你说的换成label任然改变不了内容
接近 3 年之前 回复
  function aaa()
     {
         var id = $(".sd").attr("id");

         $.ajax({
             type: "POST",
             url: "/Handler1.ashx",
             data: { id: id },
             success: function (data) {
                 $('#lable2').html(data);
             }
         });
    }

图片说明

qq_36165603
冷淡的胖子 这是我data的值 和改过之后的
接近 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
mat打不开,报错zlib.error: Error -3 while decompressing data: invalid literal/length code?请帮帮忙,谢谢
import scipy.io as scio<br> dataFile = './mnist.mat'<br> data = scio.loadmat(dataFile)<br> 报错 ``` File "mio5_utils.pyx", line 675, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 705, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 778, in scipy.io.matlab.mio5_utils.VarReader5.read_real_complex File "mio5_utils.pyx", line 450, in scipy.io.matlab.mio5_utils.VarReader5.read_numeric File "mio5_utils.pyx", line 355, in scipy.io.matlab.mio5_utils.VarReader5.read_element File "streams.pyx", line 195, in scipy.io.matlab.streams.ZlibInputStream.read_string File "streams.pyx", line 171, in scipy.io.matlab.streams.ZlibInputStream.read_into File "streams.pyx", line 158, in scipy.io.matlab.streams.ZlibInputStream._fill_buffer zlib.error: Error -3 while decompressing data: invalid literal/length code ```
Line & Circle Maze 迷宫的问题
Problem Description A deranged algorithms professor has devised a terrible final exam: he throws his students into a strange maze formed entirely of linear and circular paths, with line segment endpoints and object intersections forming the junctions of the maze. The professor gives his students a map of the maze and a fixed amount of time to find the exit before he floods the maze with xerobiton particles, causing anyone still in the maze to be immediately inverted at the quantum level. Students who escape pass the course; those who don't are trapped forever in a parallel universe where the grass is blue and the sky is green. The entrance and the exit are always at a junction as defined above. Knowing that clever ACM programming students will always follow the shortest possible path between two junctions, he chooses the entrance and exit junctions so that the distance that they have to travel is as far as possible. That is, he examines all pairs of junctions that have a path between them, and selects a pair of junctions whose shortest path distance is the longest possible for the maze (which he rebuilds every semester, of course, as the motivation to cheat on this exam is very high). The joy he derives from quantumly inverting the majority of his students is marred by the tedium of computing the length of the longest of the shortest paths (he needs this to know to decide how much time to put on the clock), so he wants you to write a program to do it for him. He already has a program that generates the mazes, essentially just a random collection of line segments and circles. Your job is to take that collection of line segments and circles, determine the shortest paths between all the distinct pairs of junctions, and report the length of the longest one. The input to your program is the output of the program that generates his mazes. That program was written by another student, much like yourself, and it meets a few of the professor's specifications: 1) No endpoint of a line segment will lie on a circle; 2)No line segment will intersect a circle at a tangent; 3) If two circles intersect, they intersect at exactly two distinct points; 4)Every maze contains at least two junctions; that is, a minimum maze is either a single line segment, or two circles that intersect. There is, however, one bug in the program. (He would like to have it fixed, but unfortunately the student who wrote the code never gave him the source, and is now forever trapped in a parallel universe.) That bug is that the maze is not always entirely connected. There might be line segments or circles, or both, off by themselves that intersect nothing, or even little "submazes" composed of intersecting line segments and circles that as a whole are not connected to the rest of the maze. The professor insists that your solution account for this! The length that you report must be for a path between connected junctions! Example: 1.2. 3.4. Detail Description: Pictrue 1: Line segments only. The large dots are the junction pair whose shortest path is the longest possible. Pictrue 2: An example using circles only. Note that in this case there is also another pair of junctions with the same length longest possible shortest path. Pictrue 3: Disconnected components. Pictrue 4: Now the line segments are connected by a circle, allowing for a longer shortest path. Input An input test case is a collection of line segments and circles. A line segment is specified as "L X1 Y1 X2 Y2" where "L" is a literal character, and (X1,Y1) and (X2,Y2) are the line segment endpoints. A circle is specified by "C X Y R" where "C" is a literal character, (X,Y) is the center of the circle, and R is its radius. All input values are integers, and line segment and circle objects are entirely contained in the first quadrant within the box defined by (0,0) at the lower left and (100,100) at the upper right. Each test case will consist of from 1 to 20 objects, terminated by a line containing only a single asterisk. Following the final test case, a line containing only a single asterisk marks the end of the input. Output For each input maze, output "Case N: ", where N is the input case number starting at one (1), followed by the length, rounded to one decimal, of the longest possible shortest path between a pair of connected junctions. Sample Input L 10 0 50 40 L 10 4 0 50 0 L 10 1 0 60 1 0 L 0 30 50 30 * C 25 2 5 25 C 50 2 5 25 C 25 5 0 25 C 50 5 0 25 * L 0 0 80 80 L 80 1 00 100 80 * L 0 0 80 80 L 80 1 00 100 80 C 85 8 5 10 * * Sample Output Ca se 1: 68.3 Ca se 2: 78.5 Ca se 3: 113.1 Ca se 4: 140.8
怎么使用javascript或者ajax去调用C++通过gsoap建立的服务器中的C++接口?
网上的资料基本都是C++通过gsoap建立服务端,然后通过客户端的方式去访问服务端中的C++接口。 我现在按照网上的一些教程,用C++通过gsoap建立了一个服务器,也生成了相关的wsdl文件。然后我用 C++再通过gsoap建立一个客户端,去调用我服务端的接口,这样的方式是可以调用的。那么问题来了: 我现在不通过建立客户端的方式去调用服务端的接口,我想通过打开网页的方式,在前端中用js(javascript)或者ajax的方式去调用,该怎么调用?我没接触前端,头痛啊,大神求教,SOS急! 这是参考网友的例子生成的wsdl文件: ``` <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/" xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/" xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:HTTP="http://schemas.xmlsoap.org/wsdl/http/" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns="http://tempuri.org/ns.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://tempuri.org/ns.xsd/Service.wsdl" targetNamespace="http://tempuri.org/ns.xsd/Service.wsdl" name="Service"> <types> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/ns.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" targetNamespace="http://tempuri.org/ns.xsd" attributeFormDefault="unqualified" elementFormDefault="unqualified"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <!-- operation request element --> <element name="helloword"> <complexType> <sequence> </sequence> </complexType> </element> <!-- operation response element --> <element name="hellowordResponse"> <complexType> <sequence> <element name="result" maxOccurs="1" minOccurs="0" type="h-string"/> <!-- ns__helloword::result --> </sequence> </complexType> </element> </schema> </types> <message name="hellowordRequest"> <part name="Body" element="ns:helloword"/> <!-- ns__helloword::ns__helloword --> </message> <message name="hellowordResponse"> <part name="Body" element="ns:hellowordResponse"/> </message> <portType name="ServicePortType"> <operation name="helloword"> <documentation>Service definition of function ns__helloword</documentation> <input message="tns:hellowordRequest"/> <output message="tns:hellowordResponse"/> </operation> </portType> <binding name="Service" type="tns:ServicePortType"> <SOAP:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <operation name="helloword"> <SOAP:operation soapAction=""/> <input> <SOAP:body use="literal" parts="Body"/> </input> <output> <SOAP:body use="literal" parts="Body"/> </output> </operation> </binding> <service name="Service"> <documentation>gSOAP 2.8.44 generated service definition</documentation> <port name="Service" binding="tns:Service"> <SOAP:address location="http://localhost:80"/> </port> </service> </definitions> 下面是C++服务器中接口: int ns__helloword(struct soap*, char **result) { (*result) = "hello world!"; return SOAP_OK; } 目的很简单就是想在网页html中调用这个接口。没接触过前端也没接触过java和ajax,js知道一点点,大神们请指点一二啊。 ```
webservice 服务端如何接收 采用document/literal调用的报文并回传
webservice 服务端如何接收 采用document/literal调用的报文和解析,并回传给客户端?![图片说明](https://img-ask.csdn.net/upload/201809/27/1538027320_625454.png)
java接口返回的json串,转JSONObject的时候报错,如何解决
在构造JSONObject对象的时候,JSONObject o = new JSONObject(json); 报错: ``` Expected literal value at character 2666 of ``` 问题已解决,使用springboot的json解析SDK包解析会失败,换成fastjson来解析,就可以成功解析,不知道是不是fastjson的容错机制做的比较好,毕竟fastjson大小写不一致都能序列化成功
A Simple Language 表达式问题
Problem Description Professor X teaches the C Programming language in college, but he finds it's too hard for his students and only a few students can pass the exam. So, he decide to invent a new language to reduce the burden on students. This new language only support four data type, but the syntax is an strict subset of C. It only support assignment operation, brackets operation , addition , subtration, multiplication and division between variables and numbers. The priority of operations is the same as C. In order to void the problem of forgetting the eliminator ";", this new language allow to omit it. The variable naming rules is the same as C. Comments is not allowed in this language. Now Prof.X need to impelment this language, and the variable part is done by himself. Now Prof.X need you, a execllent ACM coder's help: Given a section of this language's code, please calculate it's return value. Input The input contains many lines, each line is a section of codes written in the language described above, you can assume that all variables have been declared as int and have been set to 0 initially. Output To each line of input, output an integer indicate the return value of the input line. the semicolon will only appear in the end of line, you can assume that every literal, variable's value and the intermediate results of calculation would never bigger than a short integer. Notice: the result may affect by assignment operation, if you don't know the exact return value of some statements such as a=3, you can try run codes such as ' printf("%d",a=3); ' in C, and check the result. Sample Input a=3 a+b a=a*(b+2)+c; a+b a/4 _hello=2*a; Sample Output 3 3 6 6 1 12
Django创建超级用户时,出现错误 ValueError: invalid literal for int() with base 10: ''
ERROR exception 135 Internal Server Error: /users/ Traceback (most recent call last): File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/views/generic/base.py", line 68, in view return self.dispatch(request, *args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch response = self.handle_exception(exc) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception self.raise_uncaught_exception(exc) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception raise exc File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch response = handler(request, *args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/generics.py", line 242, in post return self.create(request, *args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/mixins.py", line 19, in create self.perform_create(serializer) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/mixins.py", line 24, in perform_create serializer.save() File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/serializers.py", line 213, in save self.instance = self.create(validated_data) File "/home/python/dihai02/per02/apps/users/serializers/user.py", line 25, in create user = User.objects.create_user(**validated_data) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/models.py", line 159, in create_user return self._create_user(username, email, password, **extra_fields) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/models.py", line 153, in _create_user user.save(using=self._db) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 80, in save super(AbstractBaseUser, self).save(*args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 808, in save force_update=force_update, update_fields=update_fields) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 838, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 924, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 963, in _do_insert using=using, raw=raw) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/query.py", line 1076, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1111, in execute_sql for sql, params in self.as_sql(): File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1064, in as_sql for obj in self.query.objs File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1064, in <listcomp> for obj in self.query.objs File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1063, in <listcomp> [self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields] File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1003, in prepare_value value = field.get_db_prep_save(value, connection=self.connection) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 770, in get_db_prep_save prepared=False) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 762, in get_db_prep_value value = self.get_prep_value(value) File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 1853, in get_prep_value return int(value) ValueError: invalid literal for int() with base 10: ''
使用jquery-powerfloat.js来实现的悬浮层效果在IE7或者IE8下运行,导致页面卡住
一、问题描述 在最近开发的asp.net项目使用jquery-powerfloat.js来实现网页上的悬浮层效果,当鼠标悬浮在网页的某个字符串上时显示悬浮层,移出该字符串不显示悬浮层。但是在IE7或者IE8浏览器上运行时,会导致页面卡住。 ![IE7下页面卡住截图](https://img-ask.csdn.net/upload/201911/12/1573549904_306764.png) 二、代码片段 1、主页面前端代码 ``` <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainForm.aspx.cs" Inherits="powerFloat.MainForm" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>主界面</title> </head> <body> <form id="mainform" runat="server"> <div runat="server" id="addDiv"> </div> </form> </body> </html> ``` 2、主页面的后台代码 ``` using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace powerFloat { public partial class MainForm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!Page.IsCallback) { InitData(); } } private void InitData() { Control ctl = this.LoadControl("AddWebUserControl.ascx"); ctl.ID = "Test"; addDiv.Controls.Add(ctl); addDiv.Controls.Add(new LiteralControl("<br/>")); } } } ``` 3、悬浮层前端代码 ``` <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddWebUserControl.ascx.cs" Inherits="powerFloat.AddWebUserControl" %> <style> .dn { display: none; } .shadow { -moz-box-shadow: 1px 1px 3px rgba(0, 0, 0, 4); -webkit-box-shadow: 1px 1px 3px rgba(0, 0, 0, 4); box-shadow: 1px 1px 3px rgba(0, 0, 0, 4); } .target_box { width: 700px; padding: 10px; border: 1px solid #aaa; background-color: #fff; } .target_list { padding: 4px; border-bottom: 1px dotted #ddd; overflow: hidden; _zoom: 1; } .target_list a { width: 160px; line-height: 20px; margin-right: 5px; padding: 1px; color: #333; font-size: 12px; text-align: left; text-decoration: none; float: left; } .target_list .select1 { width: 200px; line-height: 20px; margin-right: 5px; padding: 1px; color: red; font-size: 20px; text-align: left; text-decoration: none; float: left; } .target_more { margin-top: -20px; } .target_fixed { height: 25px; padding: 1px; position: fixed; _position: adsolute; top: 0; right: 0; } .custom_container { position: absolute; background-color: rgba(0, 0, 0, 5); background-color: #fff; } .custom_container img { padding: 0; position: relative; top: -5px; left: -5px; } </style> <table> <tr> <td>总署查验要求18项</td> <td> <input type="hidden" runat="server" id="hdnClientId" /> <asp:Literal ID="txt_CHECK_REQUEST_TOTAL" runat="server"></asp:Literal> </td> </tr> </table> <asp:Literal runat="server" ID="targetBox"></asp:Literal> <script src="scripts/jquery-1.4.1.js"></script> <script src="scripts/jquery-powerFloat.js"></script> <script> $(function () { var clientId = $("#Test_hdnClientId").val(); $(clientId).powerFloat( ) }); </script> ``` 4、悬浮层后台代码 ``` using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace powerFloat { public partial class AddWebUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if(!Page.IsCallback) { InitData(); } } private void InitData() { string checkRequestTotal = "000101010101001001"; txt_CHECK_REQUEST_TOTAL.Text = string.Format("<a id='{1}_trigger' href='javascript:;' rel='Test_targetBox'>{0}</a>", checkRequestTotal, this.ClientID); hdnClientId.Value = "#" + this.ClientID + "_trigger"; char[] splitChar = checkRequestTotal.ToCharArray(); ArrayList arrayList = new ArrayList(); for(int i=0;i<splitChar.Length;i++) { arrayList.Add(splitChar[i].ToString()); } string strHTML = @" <div id='ABC$$_targetBox' class='shadow target_box dn'> <div class='target_list'> <a href='javascript:;' class='select{0}'>1.辐射探测</a> <a href='javascript:;' class='select{1}'>2.预防性检疫处理</a> <a href='javascript:;' class='select{2}'>3.检查病媒/有害生物</a> </div> <div class='target_list'> <a href='javascript:;' class='select{3}'>4.动物临床检查</a> <a href='javascript:;' class='select{4}'>5.检查残留剂</a> <a href='javascript:;' class='select{5}'>6.检查车体/箱体</a> </div> <div class='target_list'> <a href='javascript:;' class='select{6}'>7.检查包装</a> <a href='javascript:;' class='select{7}'>8.核对品名</a> <a href='javascript:;' class='select{8}'>9.检查标签/标识</a> </div> <div class='target_list'> <a href='javascript:;' class='select{9}'>10.核对规格/型号</a> <a href='javascript:;' class='select{10}'>11.核对产终地</a> <a href='javascript:;' class='select{11}'>12.核对数量</a> </div> <div class='target_list'> <a href='javascript:;' class='select{12}'>13.核对重量</a> <a href='javascript:;' class='select{13}'>14.检查侵权</a> <a href='javascript:;' class='select{14}'>15.检查外观品质</a> </div> <div class='target_list'> <a href='javascript:;' class='select{15}'>16.检查夹藏/夹杂</a> <a href='javascript:;' class='select{16}'>17.检查温度</a> <a href='javascript:;' class='select{17}'>18.取样送检</a> </div> </div> "; targetBox.Text = string.Format(strHTML, arrayList.ToArray()).Replace("ABC$$", this.ClientID); } } } ``` 三、源码下载 代码使用vs2012开发的。(链接:https://pan.baidu.com/s/1Y2c3yfC7oenSZwSw1Uh0VQ 提取码:iqr4 ) 四、解决:由于jquery-powerfloat.js版本问题导致的,使用新的版本的就可以了。 jquery-powerfloat.js:链接:https://pan.baidu.com/s/1sKorCkN1UkmCFtf-6MNVxg 提取码:rh5n
python matplotlib 画两条折线图 其中一组数据有空值 如何处理?
python matplotlib 画两条折线图 其中一组数据有空值 如何处理? import csv from datetime import datetime from matplotlib import pyplot as plt filename = 'data.csv' with open(filename) as f: reader = csv.reader(f) header_row = next(reader) dates = [] temp1 = [] temp2 = [] for row in reader: time = row[1] + '-' + row[2] + '-' + row[3] current_date = datetime.strptime(time, "%Y-%m-%d") dates.append(current_date) tempm1 = int(float(row[7])) temp1.append(tempm1) tempm2 = int(row[28]) temp2.append(tempm2) fig = plt.figure(dpi=128, figsize=(10,6)) plt.plot(dates, temp1, c='red') plt.plot(dates, temp2, c='blue') plt.show() 报错: C:\Users\yo\AppData\Local\Programs\Python\Python37\python.exe F:/论文/data/compare/compare.py Traceback (most recent call last): File "F:/论文/data/compare/compare.py", line 26, in <module> tempm2 = int(row[28]) ValueError: invalid literal for int() with base 10: '20.075' Process finished with exit code 1 试过if 不为空值处理,然后数据对不齐了 我想要如果是空值图上就不显示 数据是有小数的所以就用int float 处理 请各位大神帮忙 谢谢!
ValueError: invalid literal for int() with base 10: 'aer'
#coding=utf-8 #Version:python3.6.0 #Tools:Pycharm 2017.3.2 import numpy as np import tensorflow as tf import re TRAIN_PATH="data/ptb.train.txt" EVAL_PATH="data/ptb.valid.txt" TEST_PATH="data/ptb.test.txt" HIDDEN_SIZE=300 NUM_LAYERS=2 VOCAB_SIZE=10000 TRAIN_BATCH_SIZE=20 TRAIN_NUM_STEP=35 EVAL_BATCH_SIZE=1 EVAL_NUM_STEP=1 NUM_EPOCH=5 LSTM_KEEP_PROB=0.9 EMBEDDING_KEEP_PROB=0.9 MAX_GRED_NORM=5 SHARE_EMB_AND_SOFTMAX=True class PTBModel(object): def __init__(self,is_training,batch_size,num_steps): self.batch_size=batch_size self.num_steps=num_steps self.input_data=tf.placeholder(tf.int32,[batch_size,num_steps]) self.targets=tf.placeholder(tf.int32,[batch_size,num_steps]) dropout_keep_prob=LSTM_KEEP_PROB if is_training else 1.0 lstm_cells=[ tf.nn.rnn_cell.DropoutWrapper(tf.nn.rnn_cell.BasicLSTMCell(HIDDEN_SIZE), output_keep_prob=dropout_keep_prob) for _ in range (NUM_LAYERS)] cell=tf.nn.rnn_cell.MultiRNNCell(lstm_cells) self.initial_state=cell.zero_state(batch_size,tf.float32) embedding=tf.get_variable("embedding",[VOCAB_SIZE,HIDDEN_SIZE]) inputs=tf.nn.embedding_lookup(embedding,self.input_data) if is_training: inputs=tf.nn.dropout(inputs,EMBEDDING_KEEP_PROB) outputs=[] state=self.initial_state with tf.variable_scope("RNN"): for time_step in range(num_steps): if time_step>0:tf.get_variable_scope().reuse_variables() cell_output,state=cell(inputs[:,time_step,:],state) outputs.append(cell_output) # 把输出队列展开成[batch,hidden_size*num_steps]的形状,然后再reshape成[batch*numsteps,hidden_size]的形状 output=tf.reshape(tf.concat(outputs,1),[-1,HIDDEN_SIZE]) if SHARE_EMB_AND_SOFTMAX: weight=tf.transpose(embedding) else: weight=tf.get_variable("weight",[HIDDEN_SIZE,VOCAB_SIZE]) bias=tf.get_variable("bias",[VOCAB_SIZE]) logits=tf.matmul(output,weight)+bias loss=tf.nn.sparse_softmax_cross_entropy_with_logits( labels=tf.reshape(self.targets,[-1]), logits=logits ) self.cost=tf.reduce_sum(loss)/batch_size self.final_state=state # 只在训练模型时定义反向传播操作 if not is_training:return trainable_variables=tf.trainable_variables() #控制梯度大小 grads,_=tf.clip_by_global_norm( tf.gradients(self.cost,trainable_variables),MAX_GRED_NORM) # 定义优化方法 optimizer=tf.train.GradientDescentOptimizer(learning_rate=1.0) # zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的对象,这样做的好处是节约了不少的内存。 #定义训练步骤 self.train_op=optimizer.apply_gradients( zip(grads,trainable_variables)) def run_epoch(session,model,batches,train_op,output_log,step): total_costs=0.0 iters=0 state=session.run(model.initial_state) for x,y in batches: cost,state,_=session.run( [model.cost,model.final_state,train_op], {model.input_data:x,model.targets:y, model.initial_state:state} ) total_costs+=cost iters+=model.num_steps # 只有在训练时输出日志 if output_log and step %100==0: print("After %d steps,perplexity is %.3f"%( step,np.exp(total_costs/iters) )) step +=1 return step,np.exp(total_costs/iters) # 从文件中读取数据,并返回包含单词编号的数组 def read_data(file_path): with open(file_path,"r") as fin: id_string=" ".join([line.strip() for line in fin.readlines()]) id_list=[int(w) for w in id_string.split()] # 将读取的单词编号转为整数 return id_list def make_batches(id_list,batch_size,num_step): # 计算总的batch数量,每个batch包含的单词数量是batch_size*num_step try: num_batches=(len(id_list)-1)/(batch_size*num_step) data=np.array(id_list[:num_batches*batch_size*num_step]) data=np.reshape(data,[batch_size,num_batches*num_step]) data_batches=np.split(data,num_batches,axis=1) label=np.array(id_list[1:num_batches*batch_size*num_step+1]) label=np.reshape(label,[batch_size,num_batches*num_step]) label_batches=np.split(label,num_batches,axis=1) return list(zip(data_batches,label_batches)) def main(): # 定义初始化函数 intializer=tf.random_uniform_initializer(-0.05,0.05) with tf.variable_scope("language_model",reuse=None,initializer=intializer): train_model=PTBModel(True,TRAIN_BATCH_SIZE,TRAIN_NUM_STEP) with tf.variable_scope("language_model",reuse=True,initializer=intializer): eval_model=PTBModel(False,EVAL_BATCH_SIZE,EVAL_NUM_STEP) with tf.Session() as session: tf.global_variables_initializer().run() train_batches=make_batches(read_data(TRAIN_PATH),TRAIN_BATCH_SIZE,TRAIN_NUM_STEP) eval_batches=make_batches(read_data(EVAL_PATH),EVAL_BATCH_SIZE,EVAL_NUM_STEP) test_batches=make_batches(read_data(TEST_PATH),EVAL_BATCH_SIZE,EVAL_NUM_STEP) step=0 for i in range(NUM_EPOCH): print("In iteration:%d" % (i+1)) step,train_pplx=run_epoch(session,train_model,train_batches,train_model.train_op,True,step) print("Epoch:%d Train perplexity:%.3f"%(i+1,train_pplx)) _,eval_pplx=run_epoch(session,eval_model,eval_batches,tf.no_op,False,0) print("Epoch:%d Eval perplexity:%.3f"%(i+1,eval_pplx)) _,test_pplx=run_epoch(session,eval_model,test_batches,tf.no_op(),False,0) print("Test perplexity:%.3f"% test_pplx) if __name__ == '__main__': main()
The Simple Programming Language
Problem Description Consider the following programming language. This language contains only two types of statements: simple statements and compound statements. The simple statement is in the form “write (literal)”, where “write” is a key word indicating that the content of the literal should be written to the standard output. The content of literals is surrounded by a pair of double quotes. The compound statement is in the form “if (<expression>) <statement>” or “if (<expression>) <statement> else <statement>”. Here “if” and “else” are key words and “expression” can be either “1” or “0” indicating “true” or “false”. Statement can be either compound or simple, which means compound statements can be nested. Note that each “else” should match the nearest “if”. Input The input has multiple test cases. Every test case is exactly a statement. Every test case is ended with an empty line and there will be no empty lines within a statement. Please pay attention that empty lines separate the statements and adjacent statements are independent of each other. Output For all the contents of literals that should be written to the standard output, print them on a single line, without the double quotes. The contents of literals will contain only lower case letters. Sample Input write(“q”) if(0) write(“x”) else write(“y”) if(1) if(0) write(“x”) else write(“y”) if(0) if(0) write(“x”) else write(“y”) Sample Output q y y
在MongoDB里添加中文数据的时候报错,怎么回事
> use xx switched to db xx > db xx > show dbs admin 0.000GB config 0.000GB local 0.000GB > db.xx.insert({"name":"菜鸟教程"}) 2019-09-18T13:35:06.365+0800 E QUERY [js] uncaught exception: TypeError: malformed UTF-8 character sequence at offset 22 : @:0:0 上面是运行的代码以及报错,如果把菜鸟教程换成数字就不会报错 后来我将cmd的编码改为utf-8以后,又报错 2019-09-18T14:20:47.353+0800 E QUERY [js] uncaught exception: SyntaxError: "" literal not terminated before end of script : @(shell):1:22 有没有mongodb大神出来解释一下
各位大佬帮忙看看,为什么不能翻页,只显示5个数据?
``` <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="classscoreinput.aspx.cs" Inherits="School_Web.admin.score.classscoreinput" %> <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title> <asp:Literal ID="LiteralTitle" runat="server" EnableViewState="true"></asp:Literal> </title> <script language="javascript" src="/admin/js/SystemPage.js" type="text/jscript"></script> <link href="../style/green/skin.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/admin/style/jquery/jquery.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function() { $("#topURLul").children().click(function() { $(this).siblings().removeClass().end().addClass("divURLed"); $("#mypanel").children().css("display","none"); $("#d"+ this.id).css("display",""); //alert(this.id); }); $("#topURLul").children().hover( function() { $(this).addClass("divURLon"); //akon(this); }, function() { if ($(this).attr("class") != "divURLed") { $(this).removeClass("divURLon"); } } ); }); </script> </head> <body onload="win_onLoad();"> <form id="Form1" method="post" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="tbMain"> <div class="divTbg"> <div class="divTbgL"></div> <div class="divTbgInfo"> <div class="divTbgTitle"><span class="WtableTBig">成绩管理 </span></div> </div> </div> <div class="divTbgF"></div> <div class="divTNavBG" id="topURL"> <ul id="topURLul"> <li class="divURLed" id="div1"> <div><img src="../style/green/images/mini_icons_046.gif" width="10" height="10" /><span class="tableTBig">课程基本信息</span></div> </li> <li id="div2"> <div><img src="../style/green/images/mini_icons_046.gif" width="10" height="10" /><span class="tableTBig">成绩汇总表</span></div> </li> <li id="div3"> <div><img src="../style/green/images/mini_icons_046.gif" width="10" height="10" /><span class="tableTBig">辅助计算器</span></div> </li> <li id="div4"> <div><img src="../style/green/images/mini_icons_046.gif" width="10" height="10" /><span class="tableTBig">帮助说明</span></div> </li> </ul> </div> <div id="mypanel"> <div class="divInfo" id="ddiv1"> <div class="divInfoTop"> <div class="listLeft"> <ul> <li> <div><img src="../style/green/images/basic.gif"/></div> </li> <li><span class="tableTBig">课程基本信息</span></li> </ul> </div> </div> <div class="divInfoContext"> <table width="100%" border="0" cellpadding="0" cellspacing="1" class="SkyTableLine"> <tr> <td align="center" class="SkyTDTopLine"> 开课编号 </td> <td align="center" class="SkyTDTopLine"> 课程名称 </td> <td align="center" class="SkyTDTopLine"> 开课院系 </td> <td align="center" class="SkyTDTopLine"> 开课班级 </td> <td align="center" class="SkyTDTopLine"> 开课学期 </td> <td align="center" class="SkyTDTopLine"> 开课教师 </td> <td align="center" class="SkyTDTopLine"> 课程学时 </td> <td align="center" class="SkyTDTopLine"> 课程学分 </td> </tr> <tr> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal1" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal2" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal3" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal4" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal5" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal6" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal7" runat="server"></asp:Literal> </td> <td align="center" class="SkyTDLine"><asp:Literal ID="Literal8" runat="server"></asp:Literal> </td> </tr> </table> </div> </div> <div class="divInfo" id="ddiv2"> <div class="divInfoTop"> <div class="listLeft"> <ul> <li> <div><img src="../style/green/images/basic.gif"/></div> </li> <li><span class="tableTBig">成绩汇总表</span></li> </ul> </div> </div> <div class="divInfoContext"> <div class="divSave"> <asp:Button ID="btnInit" runat="server" Text="成绩初始化" CssClass="SkyButtonFocus" OnClick="btnInit_Click" /> <asp:Button ID="btnSync" runat="server" Text="成绩同步" CssClass="SkyButtonFocus" OnClick="btnSync_Click" /> <asp:Button ID="btnSave" runat="server" Text="成绩保存" CssClass="SkyButtonFocus" OnClick="btnSave_Click" /> </div> <div style="font: 2px; line-height: 2px;"> &nbsp;</div> <asp:GridView ID="gvInfo" runat="server" AutoGenerateColumns="False" BorderStyle="None" CellPadding="1" CellSpacing="1" GridLines="None" Width="100%" CssClass="Ntable" HorizontalAlign="Center" OnRowDataBound="gvInfo_RowDataBound" PageSize="12" > <RowStyle CssClass="SkyTDLine" HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" CssClass="SkyTDTopLine"></HeaderStyle> <Columns> <asp:BoundField DataField="id" HeaderText="序号" /> <asp:BoundField HeaderText="课程名称" DataField="CourseName" /> <asp:BoundField HeaderText="学生学号" DataField="UserID" /> <asp:BoundField HeaderText="学生名称" DataField="UserName" /> <asp:TemplateField HeaderText="平时成绩"> <ItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ResultsPS") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="作业成绩"> <ItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ResultsZY") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="期中成绩"> <ItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ResultsQZ") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="期末成绩"> <ItemTemplate> <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ResultsQM") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="综合成绩"> <ItemTemplate> <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("ResultsZH") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="是否补考"> <ItemTemplate> <asp:CheckBox ID="chkIsMakeup" runat="server" Text="补考" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="补考成绩"> <ItemTemplate> <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("ResultsMakeup") %>' MaxLength="5" Width="50px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </td> </tr> </table> <div class="divInfoRight"> <webdiyer:AspNetPager ID="Pager" runat="server" UrlPaging="True" Visible="True" OnPageChanged="Pager_PageChanged" ShowNavigationToolTip="True" AlwaysShow="True"> </webdiyer:AspNetPager> </div> </div> </div> <div class="divInfo" id="ddiv3"> <div class="divInfoTop"> <div class="listLeft"> <ul> <li> <div><img src="../style/green/images/basic.gif"/></div> </li> <li><span class="tableTBig">辅助计算器</span></li> </ul> </div> </div> <div class="divInfoContext"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100" align="center" class="SkyTDTopLine"> 源成绩 </td> <td class="SkyTDLine"><asp:DropDownList ID="drpSelect" runat="server"> <asp:ListItem Value="1">平时成绩</asp:ListItem> <asp:ListItem Value="2">作业成绩</asp:ListItem> <asp:ListItem Value="3">期中成绩</asp:ListItem> <asp:ListItem Value="4">期末成绩</asp:ListItem> <asp:ListItem Value="5">综合成绩</asp:ListItem> <asp:ListItem Value="6">补考成绩</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td align="center" class="SkyTDTopLine"> 目标成绩 </td> <td class="SkyTDLine"><asp:RadioButton ID="rad1" runat="server" Checked="True" GroupName="rad" Text="普通设置" /> = <asp:TextBox ID="txt1" runat="server" MaxLength="3" Width="40px">100</asp:TextBox> (源成绩直接复制成文本中的成绩)<br /> <asp:RadioButton ID="rad2" runat="server" GroupName="rad" Text="普通复制" /> = <asp:DropDownList ID="drpSelect0" runat="server"> <asp:ListItem Value="1">平时成绩</asp:ListItem> <asp:ListItem Value="2">作业成绩</asp:ListItem> <asp:ListItem Value="3">期中成绩</asp:ListItem> <asp:ListItem Value="4">期末成绩</asp:ListItem> <asp:ListItem Value="5">综合成绩</asp:ListItem> <asp:ListItem Value="6">补考成绩</asp:ListItem> </asp:DropDownList> (源成绩直接复制到目标成绩中)<br /> <asp:RadioButton ID="rad3" runat="server" GroupName="rad" Text="比例复制" /> = <asp:TextBox ID="txt2" runat="server" MaxLength="3" Width="40px">50</asp:TextBox> %* <asp:DropDownList ID="drpSelect1" runat="server"> <asp:ListItem Value="1">平时成绩</asp:ListItem> <asp:ListItem Value="2">作业成绩</asp:ListItem> <asp:ListItem Value="3">期中成绩</asp:ListItem> <asp:ListItem Value="4">期末成绩</asp:ListItem> <asp:ListItem Value="5">综合成绩</asp:ListItem> <asp:ListItem Value="6">补考成绩</asp:ListItem> </asp:DropDownList> (源成绩乘以百分之文本比例复制到目标成绩)<br /> <asp:Button ID="btnSaveInfo" runat="server" Text="成绩保存" CssClass="SkyButtonFocus" OnClick="btnSaveInfo_Click" /> </td> </tr> </table></td> </tr> <tr> <td><br /> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100" align="center" class="SkyTDLine"> 综合计算 </td> <td class="SkyTDLine"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="SkyTDTopLine"> 平时成绩 </td> <td align="center" class="SkyTDTopLine"> 作业成绩 </td> <td align="center" class="SkyTDTopLine"> 期中成绩 </td> <td align="center" class="SkyTDTopLine"> 期末成绩 </td> <td align="center" class="SkyTDTopLine"> 综合成绩 </td> </tr> <tr> <td align="center" class="SkyTDLine"><asp:TextBox ID="txt3" runat="server" MaxLength="3" Width="40px">20</asp:TextBox> %+ </td> <td align="center" class="SkyTDLine"><asp:TextBox ID="txt4" runat="server" MaxLength="3" Width="40px">30</asp:TextBox> %+ </td> <td align="center" class="SkyTDLine"><asp:TextBox ID="txt5" runat="server" MaxLength="3" Width="40px">50</asp:TextBox> %+ </td> <td align="center" class="SkyTDLine"><asp:TextBox ID="txt6" runat="server" MaxLength="3" Width="40px">30</asp:TextBox> %= </td> <td align="center" class="SkyTDLine"><asp:Button ID="btnSaveInfoC" runat="server" Text="成绩保存" CssClass="SkyButtonFocus" OnClick="btnSaveInfoC_Click" /> </td> </tr> </table></td> </tr> </table></td> </tr> </table> </div> </div> <div class="divInfo" id="ddiv4"> <div class="divInfoTop"> <div class="listLeft"> <ul> <li> <div><img src="../style/green/images/basic.gif"/></div> </li> <li><span class="tableTBig">帮助说明</span></li> </ul> </div> </div> <div class="divInfoContext"> <table width="100%" border="0" cellpadding="0" cellspacing="1" class="SkyTDLine"> <tr> <td class="SkyTDLine">&nbsp; 1、您第一次进入一个课程的成绩输入页面需要进行初始化,也就是点击初始化按钮;<br /> 2、当您增加或者删除了选择课程的班级中的学生信息,需要进行同步成绩操作,把新加的学生的成绩同步到成绩列表;<br /> 3、成绩修改完毕后需要保存,否则操作将不进入数据库;<br /> 4、辅助计算器可以帮助您快速的输入成绩; </td> </tr> </table> </div> </div> </div> </div> <asp:Literal ID="LiteralScript" runat="server" EnableViewState="False"></asp:Literal> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"> <ProgressTemplate> <div id="divLoading"> <img src="/admin/images/loading.gif" /> </div> </ProgressTemplate> </asp:UpdateProgress> </form> </body> </html> ``` 有十个数据但是只显示5个,而且只有一页,zen'me'ban
SyntaxError: unterminated string literal;
![图片说明](https://img-ask.csdn.net/upload/201606/16/1466086387_159544.png) 为啥这个js 在tomcat 下正常,但是在websphere 下面就报这个错误?
报错信息,字符串截取问题
遇到了一个令人郁闷的错误: ``` import matplotlib.pyplot as plt plt.figure() plt.axes() file=open("C:/Users/jyz_1/Desktop/新建文本文档.txt") file=file.read() lines=file.split("重庆") x=[0,10,20,30,40] tu1,tu2,tu3,tu4,tu5=0,0,0,0,0 tl1,tl2,tl3,tl4,tl5=0,0,0,0,0 i=0 for line in lines: inn=line.index('\n') inc=line.index("C") if i==0: tu=int(line[line.find("\n",line.find("\n",inn+1))+1:inc]) if "~" in line: tl=int(line[line.index('~')+1:line.rindex('C')]) else: tl=tu i=i+1 else: tu=int(line[line.find("\n",line.find("\n",inn+1)+1)+1:inc]) if "~" in line: tl=int(line[line.index('~')+1:line.rindex('C')]) else: tl=tu ``` ``` Traceback (most recent call last): File "C:\Users\jyz_1\AppData\Local\Programs\Python\Python37-32\13.py", line 21, in <module> tu=int(line[line.find("\n",line.find("\n",inn+1)+1)+1:inc]) ValueError: invalid literal for int() with base 10: '' ``` > 以下是部分文件内容: 2016-9-20 阴 19C 微风 重庆 2016-9-21 多云 20C 微风 重庆 基本就是这些的重复。代码的目的是找到每天的最高和最低气温。 问题在于:之前的几百次循环都没有问题,不知道是哪一步就变成这样了
Crazy Basketball Fan 具体的实现
Problem Description Alex is a big fan of basketball and he enjoys watching NBA matches. But as he always has classes in the morning when the game is on, he has to read literal living broadcast with his cellphone instead of TV live. The living broadcast gives messages about who scores or who gets the rebound, etc. After watching a few games with his cellphone, Alex finds a problem. After each game, he wants to know the status of the players (score, rebound…) but the system always fails to give. So Alex decides to calculate himself. Can you help him? If one of your teammates is a crazy basketball fan, you should make him solve this problem because he will find it interesting while working on this problem. Input The first line of input contains an integer t (t<=10) indicate the number of cases. In each case, the first line contains the names of the two teams in the form of "A vs B", where A stands for the name of home team and B stands for the name of away team. The following 12 lines contain the name of the players play for the home team and another 12 lines contain the name of the players play for the away team. The first five players of each team will be the starters meaning they are on court when the game starts. All the names only contain letters from 'a' to 'z' and 'A' to 'Z' and ''' without space and the length of each name is no more than 20. All the players' names in one case will be different. Then a line contains an integer n (2<=n<=500) indicates the number of the messages given by the broadcast. The next n lines contain the messages, one message per line. The first line will always contain "Begin" and the last line will always contain "End". The game won't end during a shot or free throw, but may end at any other time. A message in other lines may be one of the following (x, x1 and x2 stand for players from the teams, m and M stand for numbers): Jump Ball x1 vs x2: this message will only be given on the second line right after "Begin". This means two players from different teams are jumping for the ball. This message will always be followed by "x Hold Ball" and x could be anyone. x Hold Ball: this message will be given if the ball is currently in no one's hand, which means: after jump ball or after a shot was made (including the last free throw) or after a shot was blocked or after timeout. x1 Pass to x2: this means the ball is passed from x1 to x2. x1 is deferent from x2 and they are from the same team. Layup/Slam Dunk/Hook Shot/Jump Shot/3pt Shot: the first four messages stand for an attempt for 2-point shot while the last message stand for an attempt for 3-point shot. These messages will only be given when someone is currently holding the ball. These messages may be followed by "Made"/"Missed"/"Blocked by x"/"x Foul". Made/Missed: If a shot was made and scored, "Made" will be given, otherwise "Missed". These two messages will be given right after a shot was attempted if the shot was not fouled or blocked. If the shot was fouled, these two messages will still be given right after "x Foul" to indicate whether the shot was made even with the foul. But if a shot was blocked, these messages will not be given since the shot is definitely missed. x Rebound: If a shot was missed, this message will be given to indicate who get the rebound (could be anyone from both teams). If someone gets the rebound, he holds the ball. Blocked by x: If a shot is blocked, this message will be given right after the message which indicates the shot. This message will always be followed by "x Hold Ball" and x could be anyone. A shot will only be blocked by a player from the opposite team with the shooter. x Foul: this message will be given when a player commit a foul to another player from the opposite team. There are two kind of foul. If this message is given right after the shot attempt, then this foul will lead to free throws. Otherwise this message will be followed by "x Hold Ball". Free Throw m of M: If a shot is fouled, the shooter will make free throws. If the fouled shot is made, then the shooter will only make one free throw. If it's missed and it's a 2-point shot, the shooter will make two free throws. If it's missed and it's a 3-point shot, the shooter will make three free throws. Each made free throw earns one point. In this message, m indicates the number of this free throw (start from 1) and M indicates the number of total free throws this player is going to attempt. Both m and M will be no bigger than 3 and m is no bigger than M. After each free throw there will be a message says "Made" or "Missed" to indicate whether the free throw is made or missed. If the last free throw is missed, just like normal shot, someone will get the rebound and if it's made, a player from the opposite team will hold the ball. No block could be made during the free throws. x Steal: If a player is now holding the ball, a player from the opposite team could steal the ball away. If someone steals the ball, he will hold it. x1 Substitution replaced by x2: this message means x1 is off court and replaced by x2. x1 and x2 are from the same team. This could only happen during timeout or before free throw or after a foul which doesn't lead to free throw. The player who is going to make a free throw won't be replaced. Before free throw means before any "Free Throw m of M" despite of m and M. Timeout: timeout could be called when someone is holding the ball. During timeout, substitution could be made. Timeout is ended with the message "x Hold Ball". It is guaranteed that all the messages are valid and follow the rules. The names of the players will not be the same with words like "rebound" and "block", etc. Actually all the names will be familiar to you if you watch NBA a lot. Output The first output line for each case will be "x1 n1-n2 x2", where x1 and x2 stand for the name of home team and away team and n1 and n2 stand for their total points. Then for each player from each team, calculate the number of his points, rebounds (including offensive and defensive), assists, steals, blocks and fouls. An assist is made when player x1 passes to player x2 and x2 makes a shot (2-pt or 3-pt) and then x1 gets the assist. A rebound is an offensive rebound when the shoot and the player who gets the rebound are from the same team (even the same player); otherwise it's a defensive rebound. Also you have to calculate the number of a player's made field goals (including 2-pt and 3-pt), attempted field goals (including 2-pt and 3-pt), made 3-pt shots, attempted 3-pt shots, made free throws and attempted free throws. Notice: if a shot is fouled and it's missed, it won't be counted as an attempt, but if it's fouled and made, it will be counted as an attempt and a made. The output form is shown in the sample output (PTS - points, OFF - offensive rebound, DEF - defensive rebound, REB - total rebound, AST - assist, STL - steal, BLK - block, PF - personal foul, FGM-A - field goal made and attempted, 3PM-A - 3-pt made and attempted, FTM-A - free throw made and attempted). There are 14 spaces before the word "PLAYER" and exact one space between each column. All the names and numbers are under their column and right alignment. The order of the players is the same with input. Home team first, then comes the away team. If a player didn't play at all (never on court), then you should print "DNP - Coach's Decision" 10 spaces after their names. Print a single line after each case. Sample Input 1 Lakers vs Celtics DerekFisher KobeBryant RonArtest PauGasol AndrewBynum LamarOdom MattBarnes SteveBlake ShannonBrown LukeWalton DerrickCaracter DevinEbanks RajonRondo RayAllen PaulPierce KevinGarnett ShaquilleO'Neal JeffGreen VonWafer GlenDavis JermaineO'Neal TroyMurphy NenadKrstic CarlosArroyo 17 Begin Jump Ball KevinGarnett vs PauGasol KobeBryant Hold Ball KobeBryant Pass to PauGasol Slam Dunk Made RajonRondo Hold Ball RajonRondo Pass to PaulPierce Jump Shot RonArtest Foul Missed Free Throw 1 of 2 Made Free Throw 2 of 2 Missed PauGasol Rebound End Sample Output Lakers 2-1 Celtics Lakers PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A DerekFisher 0 0 0 0 0 0 0 0 0-0 0-0 0-0 KobeBryant 0 0 0 0 1 0 0 0 0-0 0-0 0-0 RonArtest 0 0 0 0 0 0 0 1 0-0 0-0 0-0 PauGasol 2 0 1 1 0 0 0 0 1-1 0-0 0-0 AndrewBynum 0 0 0 0 0 0 0 0 0-0 0-0 0-0 LamarOdom DNP - Coach's Decision MattBarnes DNP - Coach's Decision SteveBlake DNP - Coach's Decision ShannonBrown DNP - Coach's Decision LukeWalton DNP - Coach's Decision DerrickCaracter DNP - Coach's Decision DevinEbanks DNP - Coach's Decision Celtics PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A RajonRondo 0 0 0 0 0 0 0 0 0-0 0-0 0-0 RayAllen 0 0 0 0 0 0 0 0 0-0 0-0 0-0 PaulPierce 1 0 0 0 0 0 0 0 0-0 0-0 1-2 KevinGarnett 0 0 0 0 0 0 0 0 0-0 0-0 0-0 ShaquilleO'Neal 0 0 0 0 0 0 0 0 0-0 0-0 0-0 JeffGreen DNP - Coach's Decision VonWafer DNP - Coach's Decision GlenDavis DNP - Coach's Decision JermaineO'Neal DNP - Coach's Decision TroyMurphy DNP - Coach's Decision NenadKrstic DNP - Coach's Decision CarlosArroyo DNP - Coach's Decision
Crazy Basketball Fan 问题
Problem Description Alex is a big fan of basketball and he enjoys watching NBA matches. But as he always has classes in the morning when the game is on, he has to read literal living broadcast with his cellphone instead of TV live. The living broadcast gives messages about who scores or who gets the rebound, etc. After watching a few games with his cellphone, Alex finds a problem. After each game, he wants to know the status of the players (score, rebound…) but the system always fails to give. So Alex decides to calculate himself. Can you help him? If one of your teammates is a crazy basketball fan, you should make him solve this problem because he will find it interesting while working on this problem. Input The first line of input contains an integer t (t<=10) indicate the number of cases. In each case, the first line contains the names of the two teams in the form of "A vs B", where A stands for the name of home team and B stands for the name of away team. The following 12 lines contain the name of the players play for the home team and another 12 lines contain the name of the players play for the away team. The first five players of each team will be the starters meaning they are on court when the game starts. All the names only contain letters from 'a' to 'z' and 'A' to 'Z' and ''' without space and the length of each name is no more than 20. All the players' names in one case will be different. Then a line contains an integer n (2<=n<=500) indicates the number of the messages given by the broadcast. The next n lines contain the messages, one message per line. The first line will always contain "Begin" and the last line will always contain "End". The game won't end during a shot or free throw, but may end at any other time. A message in other lines may be one of the following (x, x1 and x2 stand for players from the teams, m and M stand for numbers): Jump Ball x1 vs x2: this message will only be given on the second line right after "Begin". This means two players from different teams are jumping for the ball. This message will always be followed by "x Hold Ball" and x could be anyone. x Hold Ball: this message will be given if the ball is currently in no one's hand, which means: after jump ball or after a shot was made (including the last free throw) or after a shot was blocked or after timeout. x1 Pass to x2: this means the ball is passed from x1 to x2. x1 is deferent from x2 and they are from the same team. Layup/Slam Dunk/Hook Shot/Jump Shot/3pt Shot: the first four messages stand for an attempt for 2-point shot while the last message stand for an attempt for 3-point shot. These messages will only be given when someone is currently holding the ball. These messages may be followed by "Made"/"Missed"/"Blocked by x"/"x Foul". Made/Missed: If a shot was made and scored, "Made" will be given, otherwise "Missed". These two messages will be given right after a shot was attempted if the shot was not fouled or blocked. If the shot was fouled, these two messages will still be given right after "x Foul" to indicate whether the shot was made even with the foul. But if a shot was blocked, these messages will not be given since the shot is definitely missed. x Rebound: If a shot was missed, this message will be given to indicate who get the rebound (could be anyone from both teams). If someone gets the rebound, he holds the ball. Blocked by x: If a shot is blocked, this message will be given right after the message which indicates the shot. This message will always be followed by "x Hold Ball" and x could be anyone. A shot will only be blocked by a player from the opposite team with the shooter. x Foul: this message will be given when a player commit a foul to another player from the opposite team. There are two kind of foul. If this message is given right after the shot attempt, then this foul will lead to free throws. Otherwise this message will be followed by "x Hold Ball". Free Throw m of M: If a shot is fouled, the shooter will make free throws. If the fouled shot is made, then the shooter will only make one free throw. If it's missed and it's a 2-point shot, the shooter will make two free throws. If it's missed and it's a 3-point shot, the shooter will make three free throws. Each made free throw earns one point. In this message, m indicates the number of this free throw (start from 1) and M indicates the number of total free throws this player is going to attempt. Both m and M will be no bigger than 3 and m is no bigger than M. After each free throw there will be a message says "Made" or "Missed" to indicate whether the free throw is made or missed. If the last free throw is missed, just like normal shot, someone will get the rebound and if it's made, a player from the opposite team will hold the ball. No block could be made during the free throws. x Steal: If a player is now holding the ball, a player from the opposite team could steal the ball away. If someone steals the ball, he will hold it. x1 Substitution replaced by x2: this message means x1 is off court and replaced by x2. x1 and x2 are from the same team. This could only happen during timeout or before free throw or after a foul which doesn't lead to free throw. The player who is going to make a free throw won't be replaced. Before free throw means before any "Free Throw m of M" despite of m and M. Timeout: timeout could be called when someone is holding the ball. During timeout, substitution could be made. Timeout is ended with the message "x Hold Ball". It is guaranteed that all the messages are valid and follow the rules. The names of the players will not be the same with words like "rebound" and "block", etc. Actually all the names will be familiar to you if you watch NBA a lot. Output The first output line for each case will be "x1 n1-n2 x2", where x1 and x2 stand for the name of home team and away team and n1 and n2 stand for their total points. Then for each player from each team, calculate the number of his points, rebounds (including offensive and defensive), assists, steals, blocks and fouls. An assist is made when player x1 passes to player x2 and x2 makes a shot (2-pt or 3-pt) and then x1 gets the assist. A rebound is an offensive rebound when the shoot and the player who gets the rebound are from the same team (even the same player); otherwise it's a defensive rebound. Also you have to calculate the number of a player's made field goals (including 2-pt and 3-pt), attempted field goals (including 2-pt and 3-pt), made 3-pt shots, attempted 3-pt shots, made free throws and attempted free throws. Notice: if a shot is fouled and it's missed, it won't be counted as an attempt, but if it's fouled and made, it will be counted as an attempt and a made. The output form is shown in the sample output (PTS - points, OFF - offensive rebound, DEF - defensive rebound, REB - total rebound, AST - assist, STL - steal, BLK - block, PF - personal foul, FGM-A - field goal made and attempted, 3PM-A - 3-pt made and attempted, FTM-A - free throw made and attempted). There are 14 spaces before the word "PLAYER" and exact one space between each column. All the names and numbers are under their column and right alignment. The order of the players is the same with input. Home team first, then comes the away team. If a player didn't play at all (never on court), then you should print "DNP - Coach's Decision" 10 spaces after their names. Print a single line after each case. Sample Input 1 Lakers vs Celtics DerekFisher KobeBryant RonArtest PauGasol AndrewBynum LamarOdom MattBarnes SteveBlake ShannonBrown LukeWalton DerrickCaracter DevinEbanks RajonRondo RayAllen PaulPierce KevinGarnett ShaquilleO'Neal JeffGreen VonWafer GlenDavis JermaineO'Neal TroyMurphy NenadKrstic CarlosArroyo 17 Begin Jump Ball KevinGarnett vs PauGasol KobeBryant Hold Ball KobeBryant Pass to PauGasol Slam Dunk Made RajonRondo Hold Ball RajonRondo Pass to PaulPierce Jump Shot RonArtest Foul Missed Free Throw 1 of 2 Made Free Throw 2 of 2 Missed PauGasol Rebound End Sample Output Lakers 2-1 Celtics Lakers PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A DerekFisher 0 0 0 0 0 0 0 0 0-0 0-0 0-0 KobeBryant 0 0 0 0 1 0 0 0 0-0 0-0 0-0 RonArtest 0 0 0 0 0 0 0 1 0-0 0-0 0-0 PauGasol 2 0 1 1 0 0 0 0 1-1 0-0 0-0 AndrewBynum 0 0 0 0 0 0 0 0 0-0 0-0 0-0 LamarOdom DNP - Coach's Decision MattBarnes DNP - Coach's Decision SteveBlake DNP - Coach's Decision ShannonBrown DNP - Coach's Decision LukeWalton DNP - Coach's Decision DerrickCaracter DNP - Coach's Decision DevinEbanks DNP - Coach's Decision Celtics PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A RajonRondo 0 0 0 0 0 0 0 0 0-0 0-0 0-0 RayAllen 0 0 0 0 0 0 0 0 0-0 0-0 0-0 PaulPierce 1 0 0 0 0 0 0 0 0-0 0-0 1-2 KevinGarnett 0 0 0 0 0 0 0 0 0-0 0-0 0-0 ShaquilleO'Neal 0 0 0 0 0 0 0 0 0-0 0-0 0-0 JeffGreen DNP - Coach's Decision VonWafer DNP - Coach's Decision GlenDavis DNP - Coach's Decision JermaineO'Neal DNP - Coach's Decision TroyMurphy DNP - Coach's Decision NenadKrstic DNP - Coach's Decision CarlosArroyo DNP - Coach's Decision
字符串切片,哪里有错误
按照如下代码,遍历file中的字符串 ``` import matplotlib.pyplot as plt plt.figure() plt.axes() file=open("C:/Users/jyz_1/Desktop/新建文本文档.txt") file=file.read() lines=file.split("重庆") x=[0,10,20,30,40] tu1,tu2,tu3,tu4,tu5=0,0,0,0,0 tl1,tl2,tl3,tl4,tl5=0,0,0,0,0 for line in lines: tu=int(line[line.find("\n",line.index("\n")+1)+1:line.index("C")]) tl=int(line[line.index("~")+1:line.find("C",line.index("C")+1)]) ``` 然后python报错: ``` Traceback (most recent call last): File "C:\Users\jyz_1\AppData\Local\Programs\Python\Python37-32\13.py", line 11, in <module> tu=int(line[line.find("\n",line.index("\n")+1)+1:line.index("C")]) ValueError: invalid literal for int() with base 10: '阴\n10' ``` 使用debug发现是第二次索引file时tu的值错误 于是我在shell里尝试: ``` >>> lines=['2015-1-1\n阴\n11c~7c\n微风','2015-1-2\n阴\n10c~8c\n微风'] >>> for line in lines: line[line.find("\n",line.index("\n")+1)+1:line.index("c")] '11' '10' ``` 结果并没有出错!那么是哪里有问题呢?
不懂就问,python异常处理里的as有什么用?
e是个啥 ``` try: int("var") except ValueError as e: print(type(ValueError)) print(type(e)) print(ValueError) print(e) ``` ``` output: <class 'type'> <class 'ValueError'> <class 'ValueError'> invalid literal for int() with base 10: 'var' ```
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
《阿里巴巴开发手册》读书笔记-编程规约
Java编程规约命名风格 命名风格 类名使用UpperCamelCase风格 方法名,参数名,成员变量,局部变量都统一使用lowerCamelcase风格 常量命名全部大写,单词间用下划线隔开, 力求语义表达完整清楚,不要嫌名字长 ...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Linux 命令(122)—— watch 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] watch(1) manual
Linux 命令(121)—— cal 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] cal(1) manual
记jsp+servlet+jdbc实现的新闻管理系统
1.工具:eclipse+SQLyog 2.介绍:实现的内容就是显示新闻的基本信息,然后一个增删改查的操作。 3.数据库表设计 列名 中文名称 数据类型 长度 非空 newsId 文章ID int 11 √ newsTitle 文章标题 varchar 20 √ newsContent 文章内容 text newsStatus 是否审核 varchar 10 news...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
相关热词 c#怎么获得线程名 c# usb 采集器 c# csv 读取 c# sort() c# 关闭io流 c# 响应函数 插入 c#面对对象的三大特性 c# 打印 等比缩放 c#弹出右键菜单 c#1如何搞成01
立即提问