我是靠谱客的博主 柔弱指甲油,这篇文章主要介绍python 正则表达式--提取日期 替换IP为一个固定路径,现在分享给大家,希望可以做个参考。

import re
studyDate = '2018-08-09 12:10'
dateidentifier = studyDate[0:10]
pattern = re.compile(r'd+')
temp = re.findall(pattern, dateidentifier)
date = "".join(temp)
print(date)

 


import re
path = r"\127.0.0.1dcmtt1.0.0.0"
pattern_move = re.compile(r'\\d+.d+.d+.d+')
picroot = 'E:'
server_filepath , number = re.subn(pattern_move, picroot, path)
print(server_filepath)


最后

以上就是柔弱指甲油最近收集整理的关于python 正则表达式--提取日期 替换IP为一个固定路径的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(98)

评论列表共有 0 条评论

立即
投稿
返回
顶部