Home >Web Front-end >HTML Tutorial >Python自学之2016.4.9_html/css_WEB-ITnose

Python自学之2016.4.9_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:21:231120browse

今天有些事情耽搁了,晚上回来写了一个很简单的练习题其实里面想用正则匹配把数字提取出来的,无奈正则匹配没找到用法,RegExp方法也不会用,就先用字符串切片处理了。明天要把javascript的正则匹配单独拿出来练习一下。推荐一篇文章http://m.zhihu.com/question/26235428

Paste_Image.png

<!DOCTYPE  HTML><html ><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>来不及解释了,赶紧上车</title><script type="text/javascript">  //通过javascript的日期对象来得到当前的日期,并输出。  var date_time = new Date();  var week = ['日','一','二','三','四','五','六'];  document.write(date_time.getFullYear()+"年"+date_time.getMonth()+"月"+"    "+"星期"+ week[date_time.getDay()]+"<br>");  //成绩是一长窜的字符串不好处理,找规律后分割放到数组里更好操作哦  var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";  var scoreStr_split = scoreStr.split(";");//  document.write(scoreStr_split[0].slice(3)+"<br>");  var sum=0;//  var scoreStr_num = new RegExp(\d);  for(var i=0;i<scoreStr_split.length;i++)  {    sum = parseInt(scoreStr_split[i].slice(3)) + sum    }  document.write(sum+"<br>")  document.write(parseInt(sum/scoreStr_split.length));  //从数组中将成绩撮出来,然后求和取整,并输出。</script></head><body></body></html>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn