CN113721900B - Quick generation method for bored pile inspection batch based on Python - Google Patents

Quick generation method for bored pile inspection batch based on Python Download PDF

Info

Publication number
CN113721900B
CN113721900B CN202111042378.4A CN202111042378A CN113721900B CN 113721900 B CN113721900 B CN 113721900B CN 202111042378 A CN202111042378 A CN 202111042378A CN 113721900 B CN113721900 B CN 113721900B
Authority
CN
China
Prior art keywords
file
bored pile
data
excel
python
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111042378.4A
Other languages
Chinese (zh)
Other versions
CN113721900A (en
Inventor
许哲东
徐达奇
杨丽
黄小军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Polytechnic University
Original Assignee
Anhui Polytechnic University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Polytechnic University filed Critical Anhui Polytechnic University
Priority to CN202111042378.4A priority Critical patent/CN113721900B/en
Publication of CN113721900A publication Critical patent/CN113721900A/en
Application granted granted Critical
Publication of CN113721900B publication Critical patent/CN113721900B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/08Construction
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Tourism & Hospitality (AREA)
  • Entrepreneurship & Innovation (AREA)
  • General Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Primary Health Care (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a quick generation method of a bored pile inspection batch based on Python, which comprises the following steps: step 1: installing and constructing a Python development environment; step 2: arranging data required by filling out a bored pile inspection batch into an excel file; step 3: setting an identification code for each position needing to fill data in a bored pile inspection batch standard template file according to the content of the bored pile inspection batch standard template (docx format); step 4: writing and debugging a Python program; step 5: packaging and encapsulating the debugged Python program to form an exe program executable file, calling data in excel by the exe program executable file to process, and respectively filling corresponding data in each data filling position according to the identification code to generate a bored pile inspection batch file. The method is simple and quick to realize, can generate the bored pile inspection batch in batches, has a clear code structure, and can be run on own computer by all personnel without installing related software.

Description

Quick generation method for bored pile inspection batch based on Python
Technical Field
The invention relates to a method for generating construction data of bored piles, in particular to a method for quickly generating a bored pile inspection batch based on Python.
Background
The bored pile inspection lot is a construction data file which is important in bored pile construction, and in the regular engineering data inspection, the bored pile inspection lot is an important inspection object. The filling of the bored pile inspection lot relates to the inquiry of a plurality of engineering site data files and the analysis and calculation of data, the engineering quantity is more complicated, and when the engineering is driven, if the data file searching and the data analysis and calculation are automatically carried out according to the manual work, the bored pile inspection lot constructed every day cannot be completed on time, so that the workload of personnel of a project department is increased.
Python is an object-oriented programming language with a very powerful standard library and very fast running. The program designed by using Python can be packaged into an exe file, so that the file can be sent to anyone for use without installing related software.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a quick generation method of a bored pile inspection batch based on Python, through which a user can efficiently generate an electronic version inspection batch.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows: a quick generation method of a bored pile inspection batch based on Python comprises the following steps:
step 1: installing and constructing a Python development environment;
step 2: arranging data required by filling out a bored pile inspection batch into an excel file;
step 3: setting an identification code for each position needing to fill data in a bored pile inspection batch standard template file according to the content of the bored pile inspection batch standard template (docx format);
step 4: writing and debugging a Python program;
step 5: packaging and encapsulating the debugged Python program to form an exe program executable file, calling data in excel by the exe program executable file to process, and respectively filling corresponding data in each data filling position according to the identification code to generate a bored pile inspection batch file.
The first line in the excel file is the name of the required data, then each line corresponds to a bored pile inspection batch to fill in the required specific data, and all symbols are input in English.
The identification code is formed by adopting the same number of English letter codes.
In the Python program, an input function is called for inputting an executable file path of an exe program, an excel file name, a standard template file name of a bored pile inspection batch and the number of inspection batch generation; calling a read_excel function for reading excel file data; creating a custom function change_text of Python for changing text information in a bored pile test batch template file; the save function is called for saving a check lot file completed for filling.
The created custom function change_text: the change_text function contains two variables, wherein the first variable is the identification code in the standard template file of the corresponding bored pile inspection batch, and the second variable is the character string for replacing the corresponding identification code; the user-defined function change_text converts the numerical value in the read excel or the numerical value obtained through operation into a character string variable, and then assigns the character string variable, and then performs replacement to fill the character string variable data in the corresponding identification code position. Therefore, the need for numerical type is converted into character string type before using change_text function. If "cylinder top elevation" in the filling test lot is filled, the corresponding identification code in the standard template file of the bored pile test lot is HIGHTDBG, the data of the corresponding bored pile column name "cylinder top elevation" read from the excel file is assigned to a variable such as aa, and then the numerical value is converted into a character string type: aa=str (aa); finally, the change_text (HIGHTDBG, aa) is called to fill in the information of the 'cylinder top elevation' in the standard template file of the bored pile inspection batch.
And the read_excel function reads data according to the excel file name and the workbook name therein, and stores the data in a data frame data structure.
And the save function automatically names and stores the generated bored pile inspection batch file according to the exe program executable file path and the current iteration times in the code loop.
When the executable file of the exe program runs, the excel data file and the standard template file of the bored pile inspection batch with the set identification code are required to be placed in a folder where the executable file of the exe program is located.
The invention has the advantages that: the method is simple to realize, can rapidly realize the generation of the bored pile inspection batch in batches, reduces the time for searching data and calculating when filling the bored pile inspection batch, improves the working efficiency, has clear code structure, and can be operated on own computer by all personnel without installing related software.
Drawings
The following is a brief description of the contents of the drawings and the labels in the drawings which are presented in the specification of the present invention:
FIG. 1 is a flow chart of a quick generation method of a bored pile inspection lot based on Python;
FIG. 2 is a diagram of the file composition under the path that the packaged exe program runs on.
Detailed Description
The detailed description of the present invention will be further described in detail with reference to the accompanying drawings by describing the preferred embodiments.
Example 1:
a quick generation method of a bored pile inspection batch based on Python comprises the following steps:
step 1: installing and constructing a Python development environment;
step 2: arranging data required by filling out a bored pile inspection batch into an excel file;
step 3: setting an identification code for each position needing to fill data in a bored pile inspection batch standard template file according to the content of the bored pile inspection batch standard template (docx format);
step 4: writing and debugging a Python program;
step 5: packaging and encapsulating the debugged Python program to form an exe program executable file, calling data in excel by the exe program executable file to process, and respectively filling corresponding data in each data filling position according to the identification code to generate a bored pile inspection batch file.
The first line in the excel file is the name of the required data, then each line corresponds to a bored pile inspection batch to fill in the required specific data, and all symbols are input in English.
The identification code is formed by adopting the same number of English letter codes.
In the Python program, an input function is called for inputting an executable file path of an exe program, an excel file name, a standard template file name of a bored pile inspection batch and the number of inspection batch generation; calling a read_excel function for reading excel file data; creating a custom function change_text of Python for changing text information in a bored pile test batch template file; the save function is called for saving a check lot file completed for filling.
The created custom function change_text: the change_text function contains two variables, wherein the first variable is the identification code in the standard template file of the corresponding bored pile inspection batch, and the second variable is the character string for replacing the corresponding identification code; the user-defined function change_text converts the numerical value in the read excel or the numerical value obtained through operation into a character string variable, and then assigns the character string variable, and then performs replacement to fill the character string variable data in the corresponding identification code position. Therefore, the need for numerical type is converted into character string type before using change_text function. If "cylinder top elevation" in the filling test lot is filled, the corresponding identification code in the standard template file of the bored pile test lot is HIGHTDBG, the data of the corresponding bored pile column name "cylinder top elevation" read from the excel file is assigned to a variable such as aa, and then the numerical value is converted into a character string type: aa=str (aa); finally, the change_text (HIGHTDBG, aa) is called to fill in the information of the 'cylinder top elevation' in the standard template file of the bored pile inspection batch.
And the read_excel function reads data according to the excel file name and the workbook name therein, and stores the data in a data frame data structure.
And the save function automatically names and stores the generated bored pile inspection batch file according to the exe program executable file path and the current iteration times in the code loop.
When the executable file of the exe program runs, the excel data file and the standard template file of the bored pile inspection batch with the set identification code are required to be placed in a folder where the executable file of the exe program is located.
Example 2:
the invention discloses a quick generation method of a bored pile inspection batch based on Python, which comprises the following specific implementation steps:
and firstly, downloading and installing an Anaconda version of the corresponding model and carrying out environment configuration.
Secondly, newly creating an excel file, placing names of data required by filling out the bored pile inspection lot into a first row of the excel file, and then placing each row into a corresponding bored pile inspection lot to fill out the required data. Such as the two tables of chart1 and chart2 in fig. 2, can also be put into one table.
Thirdly, filling 8-bit English letter codes into corresponding text positions at the positions needing to be filled in the content of the standard template (the format of docx) of the bored pile inspection batch, and storing all the positions needing to be filled in after the identification codes are filled in, such as the mulan docx in the figure 2.
Fourth, open Anaconda Navigator, select Jupyter Notebook, newly create Python3, named jinyanpiexe. A code is entered. The code mainly comprises the following modules:
(1) Inputting code of an exe program executable file path, an excel file name, a standard template file name of a bored pile test batch and a test batch generation number on an exe program executable file runtime interface, such as:
strstr=input("input_lujing:")
strstr1=input("input_chart1:")
strstr2=input("input_chart2:")
strstr3=input("number:")
strstr4=input("input_mubanword:")
(2) Switching the catalog to the catalog of the executable file of the exe program, and importing the numpy and pandas libraries and the code of random, math, docx and random modules, such as:
import os
os.getcwd()
os.chdir(strstr)
import numpy as np
import pandas as pd
from docx import Document
import random
import math
from random import choice
(3) Reading excel file data based on a read_excel function in a pandas library, and storing the excel file data into a code of a DataFrame data structure, for example:
df=pd.read_excel(strstr1,encoding='gbk',sheet_name='sheet2')
dff=pd.read_excel(strstr2,encoding='gbk',sheet_name='sheet1')
dfff=pd.read_excel(strstr2,encoding='gbk',sheet_name='sheet2')
(4) Custom function change_text code:
def change_text(old_text,new_text):
for table in document.tables:
for row in table.rows:
for cell in row.cells:
for paragraph in cell.paragraphs:
for run in paragraph.runs:
run.text=run.text.replace(old_text,new_text)
(5) Code for obtaining corresponding data from the DataFrame data structure, and performing correlation operation and conversion of data types, such as:
nnnnn=float ('%. 2f'% (dff [ 'post-second hole bottom elevation' ]. Values [ wi ])
nnnnn=str(nnnnn)
jihe8=str (dff [ 'slump 1' ] [ wi ]) + ',' +str (dff [ 'slump 2' ] [ wi ])+ ',' +str (dff [ 'slump 3' ] [ wi ])
ccccc=float ('%, 2f'% (dff [ 'actual square volume' ]. Values [ wi ]/dff [ 'design square volume' ]. Values [ wi ])
ccccc=str(ccccc)
(6) Filling out codes of the standard template file information of the bored pile inspection batch based on the identification codes in the standard template file of the bored pile inspection batch and the acquired and processed data call change_text functions, such as:
change_text ('abcdefgk', dff [ 'pile position number' ] [ wi ])
Change_text ('gjkiedfg', str (float ('%. 2f'% (dff [ 'casing elevation' ]. Values [ wi ]))) ]
Change_text ('koiwryfh', key i) #key i is a string variable
(7) And after all the information is filled, calling the save function to save codes of the generated inspection batch file.
strujin=str + '\\' +str (wi) +'.docx' #wi) is the current number of conditional cycles, and automatic naming of the generated test lot is realized
document.save(strlujin)
Fifthly, debugging the Python program, and packaging the Python program after the debugging is completed. First, install the pyinstall module, then create a folder and put the Python file of. Py (e.g., jianyanpiexe. Py) into the folder. And opening a running box by using a Windows+R command, inputting cmd to open a cmd command window, switching to a path where a folder is located, and finally inputting pyinstarer-Fjiamanpieae. Py to finish the generation of the jiamanpieae. Exe executable file as shown in figure 2.
And step six, as shown in figure 2, placing the excel file, the exe file and the processed standard template file of the bored pile inspection batch into the same folder, and not placing subfolders. And (3) operating the exe file, and inputting related information according to the prompt, so that the bored pile inspection batch can be rapidly generated in batches.
It is obvious that the specific implementation of the present invention is not limited by the above-mentioned modes, and that it is within the scope of protection of the present invention only to adopt various insubstantial modifications made by the method conception and technical scheme of the present invention.

Claims (1)

1. A quick generation method of a bored pile inspection batch based on Python is characterized by comprising the following steps:
step 1: installing and constructing a Python development environment;
step 2: arranging data required by filling out a bored pile inspection batch into an excel file;
step 3: setting an identification code for each position needing to fill data in a bored pile inspection batch standard template file according to the content of the bored pile inspection batch standard template;
step 4: writing and debugging a Python program;
step 5: packaging and encapsulating the debugged Python program to form an exe program executable file, calling data in excel by the exe program executable file to process the data, and respectively filling corresponding data in each data filling position according to the identification code to generate a bored pile inspection batch file;
all symbols in the excel file are input in an English state;
the identification code is formed by encoding English letters with the same number;
the Python program comprises a custom function change_text, an input function call, a read_excel function and a save function; wherein: the input function is used for inputting an executable file path of an exe program, an excel file name, a standard template file name of a bored pile inspection batch and the number of inspection batch generation; the read_excel function is used for reading excel file data; creating a custom function change_text of Python for changing text information in a bored pile test batch template file; the save function is used for saving a filled check batch file;
the created custom function change_text contains two variables, wherein the first variable is the identification code in the standard template file of the corresponding bored pile inspection batch, and the second variable is the character string for replacing the corresponding identification code; the user-defined function change_text converts the numerical value in the read excel or the numerical value obtained through operation into a character string variable, and then assigns the character string variable, and then performs replacement to fill the character string variable data in the corresponding identification code position;
the read_excel function reads data according to the excel file name and the workbook name therein, and stores the data in a DataFrame data structure;
the save function automatically names and stores the generated cast-in-situ bored pile inspection batch file according to the exe program executable file path and the current iteration times in the code loop;
when the executable file of the exe program runs, the excel data file and the standard template file of the bored pile inspection batch with the set identification code are required to be placed in a folder where the executable file of the exe program is located.
CN202111042378.4A 2021-09-06 2021-09-06 Quick generation method for bored pile inspection batch based on Python Active CN113721900B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111042378.4A CN113721900B (en) 2021-09-06 2021-09-06 Quick generation method for bored pile inspection batch based on Python

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111042378.4A CN113721900B (en) 2021-09-06 2021-09-06 Quick generation method for bored pile inspection batch based on Python

Publications (2)

Publication Number Publication Date
CN113721900A CN113721900A (en) 2021-11-30
CN113721900B true CN113721900B (en) 2023-08-08

Family

ID=78682092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111042378.4A Active CN113721900B (en) 2021-09-06 2021-09-06 Quick generation method for bored pile inspection batch based on Python

Country Status (1)

Country Link
CN (1) CN113721900B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011041246A1 (en) * 2009-09-30 2011-04-07 Smartshift Gmbh Systems and methods for analyzing and transforming an application from a source installation to a target installation
JP6000465B2 (en) * 2013-09-25 2016-09-28 三菱電機株式会社 Process inspection apparatus, process inspection program, and process inspection method
CN107544814A (en) * 2017-09-16 2018-01-05 陈兴雷 A kind of method that the multiple Excel electrical forms merging datas of two classes are realized using Python
CN108153721A (en) * 2017-12-06 2018-06-12 中南林业科技大学 A kind of automatic generation method in Word file embedded chart
CN108469952A (en) * 2018-03-16 2018-08-31 祖龙(天津)科技有限公司 A kind of code generating method and kit of management game configuration
CN110543299A (en) * 2019-07-31 2019-12-06 苏州浪潮智能科技有限公司 Cloud computing management platform code generation method and device
CN111026368A (en) * 2019-11-28 2020-04-17 西安四叶草信息技术有限公司 Python-based plug-in generation method, device, equipment and storage medium
CN112464621A (en) * 2020-11-30 2021-03-09 北京航星机器制造有限公司 Python-based application software format conversion implementation method and device
CN112905450A (en) * 2021-01-31 2021-06-04 吴赛 Automatic development system of chip register based on template variable replacement

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016135729A1 (en) * 2015-02-26 2016-09-01 Israel Zimmerman A method to identify known compilers functions, libraries and objects inside files and data items containing an executable code
US20160321309A1 (en) * 2015-04-28 2016-11-03 Linkedin Corporation Offline generation and processing of gems for batch requests

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011041246A1 (en) * 2009-09-30 2011-04-07 Smartshift Gmbh Systems and methods for analyzing and transforming an application from a source installation to a target installation
JP6000465B2 (en) * 2013-09-25 2016-09-28 三菱電機株式会社 Process inspection apparatus, process inspection program, and process inspection method
CN107544814A (en) * 2017-09-16 2018-01-05 陈兴雷 A kind of method that the multiple Excel electrical forms merging datas of two classes are realized using Python
CN108153721A (en) * 2017-12-06 2018-06-12 中南林业科技大学 A kind of automatic generation method in Word file embedded chart
CN108469952A (en) * 2018-03-16 2018-08-31 祖龙(天津)科技有限公司 A kind of code generating method and kit of management game configuration
CN110543299A (en) * 2019-07-31 2019-12-06 苏州浪潮智能科技有限公司 Cloud computing management platform code generation method and device
CN111026368A (en) * 2019-11-28 2020-04-17 西安四叶草信息技术有限公司 Python-based plug-in generation method, device, equipment and storage medium
CN112464621A (en) * 2020-11-30 2021-03-09 北京航星机器制造有限公司 Python-based application software format conversion implementation method and device
CN112905450A (en) * 2021-01-31 2021-06-04 吴赛 Automatic development system of chip register based on template variable replacement

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Python编程的DEM元数据自动化归档;刘燕;《计算机软件及计算机应用》;1-4 *

Also Published As

Publication number Publication date
CN113721900A (en) 2021-11-30

Similar Documents

Publication Publication Date Title
CN103019928B (en) A kind of automated testing method and system
CN101661460B (en) Method and device for generating management system report
CN110955410A (en) Automatic code generation method, device, equipment and medium
CN104484269A (en) Method for automatically generating testing script
CN104133772A (en) Automatic test data generation method
CN108491199A (en) A kind of method and terminal automatically generating interface
CN104268073A (en) Method for generating test cases in batch mode
CN104850498B (en) A kind of filling information method of testing and system
CN108280219A (en) Text interpretation method, device, computer equipment and storage medium
CN105354072A (en) Code generation method based on Eclipse platform
CN100449484C (en) Method and system for generating artificial equipment panel
CN113721900B (en) Quick generation method for bored pile inspection batch based on Python
CN109062816A (en) A kind of method, device and equipment of software test
CN110502735B (en) Method and system for quickly manufacturing universal process file of electronic equipment
CN111753348B (en) Method and device for deepening building data model component and readable storage medium
CN113239016B (en) Database design assistance apparatus and method
CN115509519A (en) Front-end UI component library construction method and system
CN112597011B (en) Operator test case generation and optimization method based on multiple languages
CN100390783C (en) Method and system for case conversion
CN111399900B (en) API document automatic generation method and system based on python and regular expression
CN111124385B (en) Automatic generation method and system of power supply design software based on database
CN101325758A (en) Mobile communication equipment capable of displaying multiple languages and method thereof
KR100656559B1 (en) Program Automatic Generating Tools
CN112068909B (en) Nuclear power operation rule mobile execution card generation system and method
CN204360367U (en) Code automatically generating device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant