Study python_03
函数
基本思想---函数是用来重复使用的
def shili(input_):
print("我了个去 %s"%input_)
shili('你竟然')
当一个函数中即有默认参数,
又有变量参数时,
需要将默认参数放在最后面
def shili(a, b = 1):
print(a,b)
shili(99)
简单使用函数求
1/3+3/5+5/7+...+n/n+2
def xx(res):
for i in range(1,98,2):
res += i/ (i+2)
print(res)
xx(0)
简单的匹配手机号
使用正则表达式
import re
compile_ =re.compile('^1[3456789]\d{9}')# 正则表达式
res = compile_.findall('15088888888')
print(res)# 成功输出手机号,不成功输出空
简单的倒数读秒
import time
for seconds in range(10,0,-1):
time.sleep(1)
print('%d秒'%seconds)
Study python_03的更多相关文章
- Improve Your Study Habits
1.Plan your time carefully. Make a list of your weekly tasks.Then make a schedule or chart of your t ...
- RSA Study
These days I study the RSA Algorithm. It is a little complex, but not very. Also, my study has not f ...
- Machine Learning Algorithms Study Notes(3)--Learning Theory
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(1)--Introduction
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1 Introduction 1 1.1 ...
- jar tvf study.war jar命令查看war/jar包的内容
jar tvf study.war 0 Thu Oct 20 14:01:18 CST 2016 META-INF/ 137 Thu Oct 20 14:01:16 CST 2016 META-INF ...
- Mongo DB Study: first face with mongo DB
Mongo DB Study: first face with mongo DB 1. study methods: 1. Translate: I am the mongo DB organiz ...
- A Study of WebRTC Security
转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...
- study topics
永远不变的东西,原理 study roadmap: 1.user space: tizen power manager => suspend/resume or runtime? android ...
- 读书笔记2013第10本:《学得少却考得好Learn More Study Less》
<学得少却考得好Learn More Study Less>这本书最早是从褪墨网站上看到的,crowncheng翻译了全文.这本书介绍了不少学习方法,非常适合在校的学生,原文的作者Scot ...
随机推荐
- CentOS7桥接网络设置(小白向)
配置过程 查看网卡设备名:输入ifconfig 可以看到网卡设备名是ens32 注:不同版本网卡设备名是不一样的 进入到默认文件路径,输入:cd /etc/sysconfig/network-scri ...
- 小白之Python-基础中的基础05
Python-基础中的基础05 --之元组 #元组:不可变更1. 创建元组:元组必须用,表示,只加()是不行的 print 42 print (42) print 43, #这个地方会把下一行的内容打 ...
- Word运行 没有注册类
启动Word时出现Microsoft Visual Baisc窗口报错,提示"运行时错误 没有注册类""运行时错误 424 要求对象" 删除路径为 C:\用户\ ...
- 《Makefile中DEP_LIBRARIES变量的作用》
1.例子 DEP_LIBRARIES := lib@InfoSDK_api lib@WMTMedia lib@WMTUtil lib@curl 该变量是Makefile里面内置的变量,作用是指定依赖的 ...
- PHP 静态延迟绑定 static
PHP (self static parent 区别) self调用的方法和属性始终表示当前类的方法和属性 static调用的方法和属性为当前执行的类的方法和属性 parent调用的方法和属性为父类的 ...
- 运用C#编写Http服务器
什么是HTTP服务器 Web服务器是指驻留于因特网上某种类型计算机的程序.当Web浏览器(客户端)连到服务器上并请求文件时,服务器将处理该请求并将文件反馈到该浏览器上,附带的信息会告诉浏览器如何查看该 ...
- OSPF配置知识总结3(多区域配置)
OSPF配置知识总结3(多区域配置) 1.相关解释: 要解决网络规模大了以后的问题:网络的扩展性,降低路由器负载,实现路由的更快收敛 OSPF多区域的区域类型分为Area 0(骨干区域), 以及非Ar ...
- 【git】3.2git分支-分支的新建与合并
资料来源 (1) https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E7%9A%84%E6%96%B0% ...
- 【Selenium IDE】下载安装Chrome和Firefox插件IDE ide了解就行 不是重点 重点是写脚本
下载安装Chrome和Firefox插件IDE 1.Chrome的IDE安装(1)由于chrome的限制所以提供了一个小方法:链接: https://www.crx4chrome.com/crx/77 ...
- SQL 查找是否”存在”,别再用 COUNT 了,真的很费时间!
根据某一条件从数据库表中查询 『有』与『没有』,只有两种状态,那为什么在写SQL的时候,还要SELECT count(*) 呢?无论是刚入道的程序员新星,还是精湛沙场多年的程序员老手,都是一如既往的c ...

