Python Spring

mkdir()

mkdir这个函数是在pathlib.Path.mkdir这里,通过import pathlib导入;
pathlib的mkdir接收两个参数:

mkdir(parents=True, exist_ok=True)

parents:如果父目录不存在,是否创建父目录。
exist_ok:只有在目录不存在时创建目录,目录已存在时不会抛出异常。
 

os.path.join()

os.path.join()函数:连接两个或更多的路径名组件,通过import os导入;

  • 如果各组件名首字母不包含’/’,则函数会自动加上

  • 如果有一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃

  • 如果最后一个组件为空,则生成的路径以一个’/’分隔符结尾

os.path.join(FolderName,Filename)

FolderName:在这个文件夹下

Filename:文件名称

import os

Path1 = 'home'
Path2 = 'develop'
Path3 = 'code'

Path10 = Path1 + Path2 + Path3
Path20 = os.path.join(Path1,Path2,Path3)
print ('Path10 = ',Path10)
print ('Path20 = ',Path20)

输出:

Path10 = homedevelopcode
Path20 = home\develop\code

re.compile()

import re

Regex=re.compile(r'\d\d\d-\d\d\d-\d\d\d\d')
mo=Regex.search('我的电话号码是139-618-0168这个数字')
print('找到了电话号码:'+mo.group())

try-exception

try:
     检测范围
exception TypeError:
     出现异常(Exception)后的处理代码 

# Author: Greg Lee Turnquist # Paperback: 264 pages # Publisher: Packt Publishing; 1st New edition edition (May 21, 2010) # Language: English # ISBN-10: 1849510660 # ISBN-13: 978-1849510660 Amazon 的介紹: http://www.amazon.com/Spring-Python-1-1-Greg-Turnquist/dp/1849510660 Spring Python captures the concepts of the Spring Framework and Spring Security and brings them to the world of Python and provides many functional parts to assemble applications. Spring Python is all about using the many useful features of Spring to the fullest and making these features available when working with Python. Get to grips with all of the concepts of Spring and apply these to the language and environment of Python to develop powerful applications for your own personal requirements. The book provides an introduction to Spring Python and steadily takes you towards the advanced features that this integration has to offer. Spring uses the Java programming language. Spring Python, the first Spring extension to go live, allows developers to make maximum use of Spring features in Python. This book starts off by introducing each of the core building blocks of Spring Python using real code examples and high-level diagrams. It explores the various concepts of Spring Python with the help of examples and case studies and focuses on vital Spring Python features to make the lives of Python and Java developers simple. The early chapters cover simple applications with simple operations including data access, and then subsequent chapters scale up to multi-node, secured, transactional applications stopping short of very advanced level complexity. This book will help you to scale your applications without having to add unnecessary complexity
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值