Code Monkey home page Code Monkey logo
  • 👋 Hi, I’m @Qiao12-pixel
  • 👀 I’m interested in ...
  • 🌱 I’m currently learning ...
  • 💞️ I’m looking to collaborate on ...
  • 📫 How to reach me ...

''' Time:2021/10/8 18:46 Author:qiaolijie-201613336 File:demo02.py '''

import re ''' a='123--*' b=re.findall('123',a) print(b)

x='a123456b' y=re.findall('[a-z][0-9][0-9][0-9][0-9][0-9][0-9][a-z]',x) print(y) x='abcaacaccabc' rule='a[a,b,c]c' y=re.findall(rule,x) print(y) ''' '''(1)findall() 找到re匹配的所有字符串,返回一个列表

(2)search() 扫描字符串,找到这个re匹配的位置(仅仅是第一个查到的)

(3)match() 决定re是否在字符串刚开始的位置(匹配行首)''' ''' s = "010-123456789" rule = "010-\d*" rule_compile = re.compile(rule) # 返回一个对象 print(rule_compile) s_compile = rule_compile.findall(s) print(s_compile) # 打印compile()返回的对象是什么

s='abcabcacc' l=re.sub('abc','***',s)#替换字符串 m=re.subn('abc','xxx',s)#替换字符串并返回替换个数 n=re.split('b',s)#分割字符串 print(l) print(m) print(n) '''

qiao_px's Projects

chatgpt-desktop icon chatgpt-desktop

OpenAI ChatGPT desktop app for Mac, Windows, & Linux menubar using Tauri & Rust

docs icon docs

Documentations for PaddlePaddle

paddlehub icon paddlehub

Awesome pre-trained models toolkit based on PaddlePaddle.(300+ models including Image, Text, Audio and Video with Easy Inference & Serving deployment)

paddlex icon paddlex

PaddlePaddle End-to-End Development Toolkit(『飞桨』深度学习全流程开发工具)

qtexamples icon qtexamples

Qt 之 GUI 控件使用 / 网络 / 架构原理 / 运行机制理解;DTK 重绘控件方式的框架解析;IDE 技巧之 Visual Studio / Qt Creator;此为系列文章教程

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.