函数

基本思想---函数是用来重复使用的

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的更多相关文章

  1. 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 ...

  2. RSA Study

    These days I study the RSA Algorithm. It is a little complex, but not very. Also, my study has not f ...

  3. Machine Learning Algorithms Study Notes(3)--Learning Theory

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  4. Machine Learning Algorithms Study Notes(2)--Supervised Learning

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  5. Machine Learning Algorithms Study Notes(1)--Introduction

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1    Introduction    1 1.1    ...

  6. 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 ...

  7. 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 ...

  8. A Study of WebRTC Security

    转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...

  9. study topics

    永远不变的东西,原理 study roadmap: 1.user space: tizen power manager => suspend/resume or runtime? android ...

  10. 读书笔记2013第10本:《学得少却考得好Learn More Study Less》

    <学得少却考得好Learn More Study Less>这本书最早是从褪墨网站上看到的,crowncheng翻译了全文.这本书介绍了不少学习方法,非常适合在校的学生,原文的作者Scot ...

随机推荐

  1. 当win7遭遇蓝屏代码0x0000006b

    转载请注明来源:https://www.cnblogs.com/Sherlock-L/p/15069877.html 关键词:win7.蓝屏.0x0000006b 事发 话说在某个周末,当我打开电脑, ...

  2. float高度塌陷和BFC

    开启BFC方式: 1.设置浮动float(副作用比较大,不推荐) 2.将元素设置为行内块元素 display:inline-block:(不推荐) 3.将元素的overlfow设置为非visible的 ...

  3. 1. mongodb基础:cursor.forEach使用

    mongosh下载地址: https://downloads.mongodb.com/compass/mongodb-mongosh-shared-openssl3-1.6.0.x86_64.rpm? ...

  4. js 判断滚动条 是否滚动到底部

    解决问题思路 滚动条距离上面的滚动高度(scrollTop) + 滚动条本身高度 = 整个页面的高度(pageHeight) 关键点:滚动条本身高度是多少 事实上,这里就有一个思想误区,人会想直接获取 ...

  5. ubuntu拨号上网与以太网

    拨号上网使用的是ppp协议,主机和主机之间是点对点连接的,通常使用掩码255.255.255.255的方式来表示一个点对点连接. 以太网:使用的以太网协议. 拨号上网和以太网是两个完全不同的东西,如果 ...

  6. RocketMQ 如何保证消息不丢失,重复消费

    RocketMQ 如何保证消息不丢失 Producer 提供SYNC的发送消息方式,等待broker处理结果. 发送消息如果失败或者超时,则重新发送. // 同步发送消息,如果5秒内没有发送成功,则重 ...

  7. 我们后端代码这样子设置虽然这样子返回的是字符串,但是json字符串也是字符串

    我们后端代码这样子设置虽然这样子返回的是字符串 但是json字符串也是字符串,后端如果想接收的话,直接百度下怎么接收json字符串就行

  8. pj_0002_wbs_manager

    #!/usr/bin/python # -*- coding: UTF-8 -*- import env_config from class_task import Task  from lib.li ...

  9. sudo apt-get install libncurses5-dev sudo apt-get install u-boot-tools

    sudo apt-get install libncurses5-dev sudo apt-get install u-boot-tools

  10. linux中的环境变量/etc/profile /etc/bashrc ~/.bash_profile ~/.bashrc

    来源:https://blog.csdn.net/zzhongcy/article/details/108663751 /etc/profile ============ 此文件为系统的每个用户设置环 ...