当前位置:网站首页>re. Sub() usage
re. Sub() usage
2022-07-04 10:57:00 【ths512】
re.sub()
re=regular expression( Regular expressions )
sub=substitute( Replace );
re.sub Is a regular expression replacement function , Used to achieve through regular expressions , Implementation than ordinary string replace More powerful replacement function ;
str.replace(“aaa”, “bbb”): The string str Medium “aaa” Replace with “bbb”
str="sajhaskdhj111sjh111dksd333"
str1=str.replace("111","222")
print(str)#sajhaskdhj111sjh111dksd333
print(str1)#sajhaskdhj111sjh111dksd333
re.sub(pattern, repl, string, count=0, flags=0)
pattern: Pattern string
repl: The string that needs to be replaced with
string: String to be replaced
count: Number of replacements
边栏推荐
- Common system modules and file operations
- Ten key performance indicators of software applications
- Open the neural network "black box"! Unveil the mystery of machine learning system with natural language
- Jemeter script recording
- [advantages and disadvantages of outsourcing software development in 2022]
- Locust learning record I
- Summary of several job scheduling problems
- Quick sort (C language)
- 2022 ape circle recruitment project (software development)
- Canoe - the second simulation project -xvihicle1 bus database design (operation)
猜你喜欢
![[Galaxy Kirin V10] [server] FTP introduction and common scenario construction](/img/ef/f0f722aaabdc2d98723cad63d520e0.jpg)
[Galaxy Kirin V10] [server] FTP introduction and common scenario construction

Knapsack problem and 0-1 knapsack problem

Elevator dispatching (pairing project) ③

Canoe - the third simulation project - bus simulation - 3-2 project implementation
![[Galaxy Kirin V10] [desktop] printer](/img/ab/066923f1aa1e8dd8dcc572cb60a25d.jpg)
[Galaxy Kirin V10] [desktop] printer

Article publishing experiment

Learning XML DOM -- a typical model for parsing XML documents

Introduction to canoe automatic test system

Canoe - the third simulation project - bus simulation - 2 function introduction, network topology

Failed to configure a DataSource: ‘url‘ attribute is not specified... Bug solution
随机推荐
MFC document view framework (relationship between classes)
Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
Get the data of the top 100 headlines today with Tianxing data
Jianzhi offer 04 (implemented in C language)
Canoe the second simulation engineering xvehicle 3 CAPL programming (operation)
JMeter assembly point technology and logic controller
Elevator dispatching (pairing project) ③
Aike AI frontier promotion (2.14)
CAPL: on sysVar_ Update difference on sysvar
Hidden C2 tunnel -- use of icmpsh of ICMP
[Galaxy Kirin V10] [desktop] login system flash back
Installation of ES plug-in in Google browser
Time complexity and space complexity
Heartbeat启动后无反应
Summary of several job scheduling problems
Canoe - the second simulation engineering - xvehicle - 2panel design (principle, idea)
2、 Operators and branches
Iterator generators and modules
Application and Optimization Practice of redis in vivo push platform
[Galaxy Kirin V10] [desktop] build NFS to realize disk sharing