当前位置:网站首页>0706-- replace fields in the use case, such as mobile phone number or ID
0706-- replace fields in the use case, such as mobile phone number or ID
2022-06-25 15:16:00 【Students' notes of Cai Cai make little progress every day】
Page page
The first 43 A video explaining
"""
-*- coding:utf-8 -*-
@Time :2021/6/23 11:37
@AUTHOR : Vegetable classmate
@SOFTWARE :lemon1
"""
"""
1、 stay EXCEL In the use case of ,mark The rules :# value # Use this to indicate that the current field needs to be replaced
2、 In use cases , When the mobile phone number needs to be replaced ,
Encapsulates the handle_data Defines the method replace_mark_with_data
Methods the internal :
Traverse case - Data for each request
If you find mark, The replacement
3、 A use case involves data , Yes url、request_data、check_sql
"""
def replace_mark_with_data(case,mark,real_data): # The body of the function
"""
Traverse a http Request all the data involved in the use case , If every data needs to be replaced , Will replace .
case: excel Read out a piece of data . It's a dictionary .
mark: Placeholder in data .# value #
real_data: To replace mark The real data .
"""
for key,value in case.items(): # Traverse the key values
if value is not None and isinstance(value,str): # If value Value is not null or value Is string
if value.find(mark) != -1: # If in value The value of this tag can be found in the value
case[key] = value.replace(mark,real_data) # Mark the mark Replace the real value
return case # Return the data
if __name__ == '__main__':
case = {
"method": "POST",
"url": "http://api.XXX.com/futureloan/#phone#/member/register",
"request_data": '{"mobile_phone": "#phone#", "pwd": "123456789", "type": 1, "reg_name": " Vegetable classmate 1"}'
}
if case["request_data"].find("#phone#") != -1: # If you can find it in the use case #phone# This field , Just replace
case = replace_mark_with_data(case,"#phone#",'123456789') # The ginseng
for key,value in case.items(): # Print after traversal
print(key,value)
边栏推荐
- p1408
- Go language template text/template error unexpected EOF
- A deformation problem of Hanoi Tower
- Statistical analysis - data level description of descriptive statistics
- ‘make_ unique’ is not a member of ‘std’
- 14 -- validate palindrome string II
- QT set process startup and self startup
- 2. operator and expression multiple choice questions
- What moment makes you think there is a bug in the world?
- Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat
猜你喜欢

What moment makes you think there is a bug in the world?

Shared memory synchronous encapsulation

(2) Relational database

From 408 to independent proposition, 211 to postgraduate entrance examination of Guizhou University

Design and implementation of timer

Review of arrays and pointers triggered by a topic

Learning C language today is the first time to learn C language. In college, C linguistics is not good, but I want to make progress, so I found a beep video on the Internet to learn C language

QT loading third-party library basic operation

Learning notes on February 8, 2022 (C language)
![[paper notes] semi supervised object detection (ssod)](/img/18/9fba70e6e4329722d9c6ad51d15724.jpg)
[paper notes] semi supervised object detection (ssod)
随机推荐
System Verilog - thread
QT set process startup and self startup
How to combine multiple motion graphs into a GIF? Generate GIF animation pictures in three steps
Compile Caffe's project using cmake
(1) Introduction
One question per day, a classic simulation question
QT inline dialog
basic_ String mind map
QT animation loading and closing window
SPARQL learning notes of query, an rrdf query language
Image segmentation based on deep learning: network structure design
Using R language in jupyter notebook
Learning notes on February 8, 2022 (C language)
Data feature analysis skills - correlation test
Why should the coroutine be set to non blocking IO
‘make_ unique’ is not a member of ‘std’
Fishing detection software
Master XSS completely from 0 to 1
One code per day - day one
AB string interchange