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 ...
随机推荐
- ASP.NET Core Filter如何支持依赖注入
通过Filter来支持:分别有IResourceFilter AuthorizeFilter ActionFilter ExceptionFilter ResultFilter,Filter也被称为拦 ...
- 光盘实现半自动化安装linux以及PXE实现自动安装
重点 实验一:使用 kickstart 半自动化安装CentOS系统 可以将定制安装光盘,并结合kickstart实现基于光盘启动的半自动化安装 实现过程 首先下载httpd搭建个web网页 [ro ...
- 软件工程日报三——创建一个简单app和SDK的介绍
昨天讲安卓studio和gradle等软件和环境都配置成功,今天开始创建第一个app. 一.打开Android studio,创建一个新文件,点击File,选择New Project里面的Empty ...
- 24_webpack_打包分析
一.打包时间的分析 如果我们希望看到每一个loader和plugin消耗的打包时间,可以借助于一个插件:speed-measure-webpakc-plugin 安装:npm i speed-meas ...
- 根据Query的名字查找是那个CLF逻辑中使用
select cdodefinition.cdoname, CLFeventMap.Name "Method", CLFDefinition.CLFNAME CLF--, CLFS ...
- go-使用 vscore 调试 go 语言
{ // 使用 IntelliSense 了解相关属性. // 悬停以查看现有属性的描述. // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linki ...
- win10系统解决启动虚拟机蓝屏问题
1.查看电脑是否开启了虚拟化,如果没起开开启 CTR+SHIFT+Esc 2.是否开启了虚拟化选项 win+r 输入 OptionalFeatures
- Autojs页面开发
概述: Autojs功能很强大! 可以打包成apk文件装在手机里运行,也可以做页面UI级别的开发.本文主要对基础页面开发常用方法.demo.资料做收集, 属于比较基础的文章.大佬请略过....... ...
- Gitblit的windows安装(java编写)
准备工作: 1.jdk(大于等于1.8版本)2.GitBlit压缩包:jdk下载地址:https://www.java.com/zh-CN/Gitblit下载地址:http://www.gitblit ...
- C++ 17 遍历文件夹图片文件进行循环操作
#include <filesystem>using namespace std;namespace fs = std::filesystem; string path = filepat ...

