CN118113381A - Calling method and product between Python language and C++ language - Google Patents

Calling method and product between Python language and C++ language Download PDF

Info

Publication number
CN118113381A
CN118113381A CN202410057974.7A CN202410057974A CN118113381A CN 118113381 A CN118113381 A CN 118113381A CN 202410057974 A CN202410057974 A CN 202410057974A CN 118113381 A CN118113381 A CN 118113381A
Authority
CN
China
Prior art keywords
language
python
environment
python language
call request
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.)
Pending
Application number
CN202410057974.7A
Other languages
Chinese (zh)
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.)
Pacific Insurance Technology Co Ltd
Original Assignee
Pacific Insurance Technology Co Ltd
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 Pacific Insurance Technology Co Ltd filed Critical Pacific Insurance Technology Co Ltd
Priority to CN202410057974.7A priority Critical patent/CN118113381A/en
Publication of CN118113381A publication Critical patent/CN118113381A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The application discloses a calling method and a calling product between Python language and C++ language. Receiving a first call request aiming at a C++ language in a Python language environment; analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language; converting the C++ language into a Python language according to keywords in the C++ language by using calling rules; the Python language is transmitted back into the Python language environment such that the Python language is deployed in the Python language environment. Therefore, in the application, the C++ language is converted into the Python language which can be used in the Python language environment by utilizing the call rule constructed in advance, so that the automatic call between the C++ language and the Python language is realized, the use of related technical schemes is avoided, the manpower consumption is reduced, and the test efficiency is improved.

Description

Calling method and product between Python language and C++ language
Technical Field
The application relates to the technical field of data processing, in particular to a calling method and a product between Python language and C++ language.
Background
Image processing software based on artificial intelligence is usually developed by Python language and C++ language, and often needs to be called back and forth between the Python language and the C++ language in the software development process so as to realize the test of the software. In the related art, a developer who is proficient in the Python language and a developer who is proficient in the c++ language cooperate together to complete the testing work of software, however, the testing process of each software needs to be implemented through the above process, which greatly reduces the testing efficiency. Therefore, how to improve the test efficiency is a major concern for those skilled in the art.
Disclosure of Invention
Based on the problems, the application provides a calling method and a product between Python language and C++ language, aiming at improving the test efficiency. The embodiment of the application discloses the following technical scheme:
in a first aspect, the application discloses a calling method between a Python language and a C++ language, which comprises the following steps:
Receiving a first call request for a C++ language in a Python language environment, wherein the first call request comprises a request for converting the C++ language into the Python language in the Python language environment;
Analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language;
Converting the C++ language into the Python language according to keywords in the C++ language by using calling rules, wherein the calling rules comprise rules for converting between the C++ language and the Python language;
transmitting the Python language back into the Python language environment so that the Python language is used in the Python language environment.
Optionally, before said transferring said Python language back into said Python language environment, to use said Python language in said Python language environment, further comprising:
Acquiring a Python language virtual environment;
And sending the Python language to the Python language virtual environment, and applying the Python language in the Python language virtual environment to obtain an operation result.
Optionally, the transmitting the Python language back to the Python language environment includes:
And if the operation result is that the operation is successful, transmitting the Python language to the Python language environment.
Optionally, before the receiving the first call request for the c++ language in the Python language environment, the method further includes:
acquiring a plurality of C++ languages with different data types and a plurality of Python languages with different data types;
the calling rule is obtained through the following steps:
extracting keywords of the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types respectively to obtain C++ keywords corresponding to the C++ languages of the plurality of different data types and Python keywords corresponding to the Python languages of the plurality of different data types respectively;
And carrying out rule construction on the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types according to the plurality of C++ keywords and the plurality of Python keywords to obtain calling rules.
Optionally, the method further comprises:
Receiving a second call request for the Python language in a c++ language environment, wherein the second call request comprises a request for converting the Python language into the c++ language in the c++ language environment;
Analyzing the second call request aiming at the Python language to obtain keywords in the Python language;
converting the Python language into the C++ language according to the keywords in the Python language by using the calling rule;
Transmitting the C++ language back to the C++ language environment so that the C++ language is used in the C++ language environment.
In a second aspect, the present application discloses a calling device between Python language and c++ language, including:
a first call request receiving unit, configured to receive a first call request for a c++ language in a Python language environment, where the first call request includes a request for converting the c++ language into a Python language in the Python language environment;
The first call request analysis unit is used for analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language;
a first language conversion unit configured to convert the c++ language into the Python language according to a keyword in the c++ language using a calling rule including a rule for converting between the c++ language and the Python language;
And the first language transmission unit is used for transmitting the Python language back to the Python language environment so as to apply the Python language in the Python language environment.
Optionally, the apparatus further includes:
The virtual environment acquisition unit is used for acquiring a Python language virtual environment;
And the operation result obtaining unit is used for sending the Python language to the Python language virtual environment and applying the Python language in the Python language virtual environment to obtain an operation result.
Optionally, the first language transmission unit is specifically configured to:
And if the operation result is that the operation is successful, transmitting the Python language to the Python language environment.
Optionally, the apparatus further includes:
A plurality of language acquisition units for acquiring a plurality of C++ languages of different data types and a plurality of Python languages of different data types;
the calling rule is obtained through the following steps:
extracting keywords of the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types respectively to obtain C++ keywords corresponding to the C++ languages of the plurality of different data types and Python keywords corresponding to the Python languages of the plurality of different data types respectively;
And carrying out rule construction on the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types according to the plurality of C++ keywords and the plurality of Python keywords to obtain calling rules.
Optionally, the apparatus further includes:
a second call request receiving unit, configured to receive a second call request for the Python language in a c++ language environment, where the second call request includes a request for converting the Python language into the c++ language in the c++ language environment;
The second call request analysis unit is used for analyzing the second call request aiming at the Python language to obtain keywords in the Python language;
A second language conversion unit, configured to convert the Python language into the c++ language according to the keyword in the Python language by using the calling rule;
The second language transmission unit is used for transmitting the C++ language back to the C++ language environment so as to enable the C++ language to be used in the C++ language environment.
In a third aspect, an embodiment of the present application provides an electronic device, including:
A memory for storing a computer program;
and the processor is used for realizing the steps of the calling method between the Python language and the C++ language in the first aspect when the computer program is executed.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the calling method between the Python language and the c++ language in the first aspect.
Compared with the prior art, the application has the following beneficial effects:
In the application, first call requests aiming at the C++ language in a Python language environment are received firstly, then the first call requests aiming at the C++ language are analyzed to obtain keywords in the C++ language, the C++ language is converted into the Python language according to the keywords in the C++ language by using call rules, and finally the Python language is transmitted back to the Python language environment, so that the Python language is applied in the Python language environment. Therefore, in the application, the C++ language is converted into the Python language which can be used in the Python language environment by utilizing the call rule constructed in advance, so that the automatic call between the C++ language and the Python language is realized, the use of related technical schemes is avoided, the manpower consumption is reduced, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the application, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flowchart of a method for calling between Python language and C++ language according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a call device between Python language and C++ language according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without making any inventive effort are within the scope of the present application.
It should be noted that, the calling method and the product between the Python language and the c++ language provided by the present application are used in the technical field of data processing, and the foregoing is merely an example, and does not limit the application fields of the method and the device name provided by the present application.
As described above, image processing software based on artificial intelligence is typically developed from Python language and C++ language, i.e., an artificial intelligence model is written in Python language and an image processing algorithm is written in C++ language, and often calls back and forth between Python language and C++ language are required to test the software during the software development process. In the related art, a developer who is proficient in the Python language and a developer who is proficient in the c++ language cooperate together to complete the testing work of software, however, the testing process of each software needs to be implemented through the above-mentioned process, which greatly reduces the testing efficiency and the testing quality. Therefore, how to improve the test efficiency is a major concern for those skilled in the art.
The inventor proposes the technical scheme of the application to improve the testing efficiency. In the embodiment of the application, a first call request aiming at a C++ language in a Python language environment is received firstly, then the first call request aiming at the C++ language is analyzed to obtain keywords in the C++ language, the C++ language is converted into the Python language according to the keywords in the C++ language by using a call rule, and finally the Python language is transmitted back to the Python language environment, so that the Python language is applied in the Python language environment. Therefore, in the application, the C++ language is converted into the Python language which can be used in the Python language environment by utilizing the call rule constructed in advance, so that the automatic call between the C++ language and the Python language is realized, the use of related technical schemes is avoided, the reduction of manpower consumption is realized, and the test efficiency and the test quality are improved.
The method provided by the embodiment of the application can be executed by software on the terminal equipment. The terminal equipment can be, for example, mobile phones, tablet computers, computers and other equipment. The software may be, for example, system software.
Several terms which may be involved in the following embodiments of the present application will be explained first.
Python language: which is a cross-platform computer programming language used to write automation scripts.
C++ language: the method is inheritance of the C language, can carry out procedural programming of the C language, can carry out object-based programming with abstract data types as characteristics, and can also carry out object-oriented programming with inheritance and polymorphism as characteristics.
In order to better understand the aspects of the present application, the present application will be described in further detail with reference to the accompanying drawings and detailed description.
The following describes a calling method between the Python language and the C++ language provided by the application through an embodiment.
Referring to fig. 1, the flowchart of a method for calling between Python language and c++ language according to an embodiment of the present application is shown in fig. 1, where the method includes:
S101: a first call request for a C++ language in a Python language environment is received.
In this step, the first call request includes a request to convert the C++ language to the Python language in the Python language environment. It can be understood that when the data written in the c++ language is needed in the Python language environment of software development, a call request for the data written in the c++ language can be sent to the development device through the API interface at this time, so that the development device can call the data written in the c++ language in a subsequent process according to the call request.
The API interface is written in the C++ language and the Python language and is used for receiving a call request and calling the C++ language/the Python language. It should be noted that the Python language environment may be in a scientific computing scenario or in an image processing scenario, which is not limited herein.
It should be further noted that, before receiving the first call request for the c++ language in the Python language environment, the present application may further obtain a plurality of c++ languages with different data types and Python languages with different data types. The different data types may include classes of functions, class members of functions, and the like, and it should be noted that the different data types also include data types that are not mentioned in the c++ language and Python language in the rest of the embodiments of the present application.
Further, in the embodiment of the present application, the call rule may be obtained according to the following procedure. Firstly, extracting keywords of a plurality of C++ languages with different data types to obtain C++ keywords respectively corresponding to the C++ languages with different data types, wherein it can be understood that function names of various C++ languages can be extracted and used as the C++ keywords; and extracting keywords of Python languages of a plurality of different data types to obtain Python keywords respectively corresponding to the Python languages of the plurality of different data types, correspondingly, extracting function names of various Python languages, and taking the function names as the Python keywords. Such as: keywords may be declspec, dllexport, etc.
It should be noted that, in the embodiment of the present application, the c++ languages of a plurality of different data types are in one-to-one correspondence with the Python languages of a plurality of different data types, that is, the meaning expressed between the c++ language and the Python language corresponding thereto is the same, but because the operating environments are different, the data types presented by the c++ language and the Python language corresponding thereto are not completely the same.
After that, a plurality of c++ keywords may be one-to-one corresponding to a plurality of Python keywords, such as: c++ A keywords and PythonA keywords, then determining the C++ language corresponding to the C++ keywords through the C++ keywords, determining the Python language corresponding to the Python keywords through the Python keywords, and constructing a corresponding relation between the C++ language and the Python language, so that the language to be called can be quickly determined according to the keywords after a call request is received. The process is repeated in this manner to implement rule construction of a plurality of different data types of C++ language and a plurality of different data types of Python language to obtain calling rules.
S102: and analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language.
It will be appreciated that the first call request includes a call description for the c++ language, such as: the call is described as requiring the C++ language with function name XXX, at which point the first call request may be parsed to determine keywords in the C++ language.
S103: and converting the C++ language into the Python language according to the keywords in the C++ language by using calling rules.
In this step, the calling rule includes a rule for converting between the c++ language and the Python language, and it is understood that the calling rule may convert the c++ language into the Python language or convert the Python language into the c++ language. Specifically, in the embodiment of the present application, the c++ language corresponding to the keyword may be determined according to the keyword in the c++ language by using the calling rule, and then the c++ language may be converted into the Python language by using the calling rule. Thus, the automatic call between the C++ language and the Python language is realized.
S104: transmitting the Python language back into the Python language environment so that the Python language is used in the Python language environment.
In one implementation manner, the present application may further obtain a Python language virtual environment before transmitting the Python language back to the Python language environment, so that the Python language virtual environment may be obtained before the Python language is used in the Python language environment, and thereafter, the Python language may be sent to the Python language virtual environment, and the Python language may be used in the Python language virtual environment to obtain the operation result. The Python language virtual environment is used for running the called Python language so as to verify the called Python language in advance, and the formal running accuracy is improved.
Specifically, in the embodiment of the present application, if the operation result is that the operation is successful, the Python language is transmitted to the Python language environment, and if the operation result is that the operation is failed, step S103 is executed again until the operation result is that the operation is successful. It should be noted that, if the operation result is that the number of times of operation failure is greater than the preset number of times, the result may be fed back to the user, where the preset number of times may be 10 times, which is not limited herein specifically.
In addition, in the embodiment of the present application, a second call request for the Python language in the c++ language environment may be received, after that, the second call request for the Python language may be parsed to obtain keywords in the Python language, and the Python language may be converted into the c++ language according to the keywords in the Python language by using the call rule, and finally the c++ language may be transmitted back to the c++ language environment, so that the c++ language may be used in the c++ language environment. Wherein the second call request comprises a request to convert the Python language to the c++ language in the c++ language environment. Thus, the automatic call between the C++ language and the Python language is realized.
It should be noted that, the parsing process and the converting process mentioned in the process of converting the Python language into the c++ language are described in the process of converting the c++ language into the Python language, and are not described herein.
In another implementation manner, the application can also acquire the C++ language virtual environment before transmitting the C++ language back to the C++ language environment so as to apply the C++ language in the C++ language environment, wherein the C++ language virtual environment is used for running the called C++ language so as to verify the called C++ language in advance, thereby improving the formal running accuracy. It should be noted that, in the embodiment of the present application, the Python language virtual environment and the c++ language virtual environment are the same debug environment, so that development efficiency and quality can be improved.
In summary, in this embodiment, the call rule constructed in advance may be used to convert the c++ language into the Python language that can be used in the Python language environment, so as to implement automatic call between the c++ language and the Python language, avoid using related technical schemes, implement reduction of manpower consumption, and implement transmission and use of various data between different languages, thereby improving test efficiency and test quality.
The following describes a call device between a Python language and a c++ language provided by an embodiment of the present application, and a call device between a Python language and a c++ language described below and a call method between a Python language and a c++ language described above may be referred to correspondingly.
Referring to fig. 2, the structure diagram of a call device between Python language and c++ language provided by the embodiment of the present application is shown in fig. 2, where the call device between Python language and c++ language includes:
A first call request receiving unit 201, configured to receive a first call request for a c++ language in a Python language environment, where the first call request includes a request for converting the c++ language into a Python language in the Python language environment;
A first call request parsing unit 202, configured to parse the first call request specific to the c++ language, and obtain a keyword in the c++ language;
A first language conversion unit 203 for converting the c++ language into the Python language according to a keyword in the c++ language using a calling rule including a rule for converting between the c++ language and the Python language;
a first language transmission unit 204, configured to transmit the Python language back to the Python language environment, so that the Python language is used in the Python language environment.
Optionally, the apparatus further includes:
The virtual environment acquisition unit is used for acquiring a Python language virtual environment;
And the operation result obtaining unit is used for sending the Python language to the Python language virtual environment and applying the Python language in the Python language virtual environment to obtain an operation result.
Optionally, the first language transmission unit 204 is specifically configured to:
And if the operation result is that the operation is successful, transmitting the Python language to the Python language environment.
Optionally, the apparatus further includes:
A plurality of language acquisition units for acquiring a plurality of C++ languages of different data types and a plurality of Python languages of different data types;
the calling rule is obtained through the following steps:
extracting keywords of the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types respectively to obtain C++ keywords corresponding to the C++ languages of the plurality of different data types and Python keywords corresponding to the Python languages of the plurality of different data types respectively;
And carrying out rule construction on the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types according to the plurality of C++ keywords and the plurality of Python keywords to obtain calling rules.
Optionally, the apparatus further includes:
a second call request receiving unit, configured to receive a second call request for the Python language in a c++ language environment, where the second call request includes a request for converting the Python language into the c++ language in the c++ language environment;
The second call request analysis unit is used for analyzing the second call request aiming at the Python language to obtain keywords in the Python language;
A second language conversion unit, configured to convert the Python language into the c++ language according to the keyword in the Python language by using the calling rule;
The second language transmission unit is used for transmitting the C++ language back to the C++ language environment so as to enable the C++ language to be used in the C++ language environment.
The calling device between the Python language and the C++ language provided by the embodiment of the application has the same beneficial effects as the calling method between the Python language and the C++ language provided by the embodiment, so that the calling device is not repeated.
Electronic device embodiment
Referring to fig. 3, the schematic structural diagram of an electronic device according to an embodiment of the present application, as shown in fig. 3, includes:
A memory 11 for storing a computer program;
And a processor 12, configured to implement the steps of the calling method between the Python language and the c++ language according to any of the above method embodiments when executing the computer program.
In this embodiment, the device may be a PC (Personal Computer ), or may be a terminal device such as a smart phone, a tablet computer, a palm computer, a portable computer, or the like.
The device may include a memory 11, a processor 12, and a bus 13. The memory 11 includes at least one type of readable storage medium including flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the device, such as a hard disk of the device. The memory 11 may also be an external storage device of the device, such as a plug-in hard disk provided on the device, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), etc. in other embodiments. Further, the memory 11 may also include both an internal storage unit of the device and an external storage device. The memory 11 may be used not only for storing application software installed in the device and various types of data, but also for temporarily storing data that has been output or is to be output.
Processor 12 may be, in some embodiments, a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip for executing program code or processing data stored in memory 11.
The bus 13 may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 3, but not only one bus or one type of bus.
Further, the device may also include a network interface 14, and the network interface 14 may optionally include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the device and other electronic devices.
Optionally, the device may further comprise a user interface 15, the user interface 15 may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 15 may further comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the device and for displaying a visual user interface.
Fig. 3 shows only a device having components 11-15, it will be understood by those skilled in the art that the configuration shown in fig. 3 is not limiting of the device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
Readable storage medium embodiments
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the computer program realizes the steps of the calling method between the Python language and the C++ language when being executed by a processor. Wherein the storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be further noted that, in the embodiments of the present application, the "first" and the "second" in the names of "first" and "second" (where any exists) are only used for name identification, and do not represent the first and second in sequence.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The calling method and the product between the Python language and the C++ language provided by the application are described in detail. The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the application can be made without departing from the principles of the application and these modifications and adaptations are intended to be within the scope of the application as defined in the following claims.

Claims (10)

1. A method for calling between Python and c++ languages, comprising:
Receiving a first call request for a C++ language in a Python language environment, wherein the first call request comprises a request for converting the C++ language into the Python language in the Python language environment;
Analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language;
Converting the C++ language into the Python language according to keywords in the C++ language by using calling rules, wherein the calling rules comprise rules for converting between the C++ language and the Python language;
transmitting the Python language back into the Python language environment so that the Python language is used in the Python language environment.
2. The method of claim 1, further comprising, prior to said transmitting said Python language back into said Python language environment such that said Python language is employed in said Python language environment:
Acquiring a Python language virtual environment;
And sending the Python language to the Python language virtual environment, and applying the Python language in the Python language virtual environment to obtain an operation result.
3. The method of claim 2, wherein said transmitting said Python language back into said Python language environment comprises:
And if the operation result is that the operation is successful, transmitting the Python language to the Python language environment.
4. The method of claim 1, further comprising, prior to said receiving a first call request in the Python language environment for the c++ language:
acquiring a plurality of C++ languages with different data types and a plurality of Python languages with different data types;
the calling rule is obtained through the following steps:
extracting keywords of the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types respectively to obtain C++ keywords corresponding to the C++ languages of the plurality of different data types and Python keywords corresponding to the Python languages of the plurality of different data types respectively;
And carrying out rule construction on the C++ languages of the plurality of different data types and the Python languages of the plurality of different data types according to the plurality of C++ keywords and the plurality of Python keywords to obtain calling rules.
5. The method as recited in claim 1, further comprising:
Receiving a second call request for the Python language in a c++ language environment, wherein the second call request comprises a request for converting the Python language into the c++ language in the c++ language environment;
Analyzing the second call request aiming at the Python language to obtain keywords in the Python language;
converting the Python language into the C++ language according to the keywords in the Python language by using the calling rule;
Transmitting the C++ language back to the C++ language environment so that the C++ language is used in the C++ language environment.
6. A call device between Python language and c++ language, comprising:
a first call request receiving unit, configured to receive a first call request for a c++ language in a Python language environment, where the first call request includes a request for converting the c++ language into a Python language in the Python language environment;
The first call request analysis unit is used for analyzing the first call request aiming at the C++ language to obtain keywords in the C++ language;
a first language conversion unit configured to convert the c++ language into the Python language according to a keyword in the c++ language using a calling rule including a rule for converting between the c++ language and the Python language;
And the first language transmission unit is used for transmitting the Python language back to the Python language environment so as to apply the Python language in the Python language environment.
7. The apparatus of claim 6, wherein the apparatus further comprises:
The virtual environment acquisition unit is used for acquiring a Python language virtual environment;
And the operation result obtaining unit is used for sending the Python language to the Python language virtual environment and applying the Python language in the Python language virtual environment to obtain an operation result.
8. The apparatus according to claim 7, wherein the first language transmission unit is specifically configured to:
And if the operation result is that the operation is successful, transmitting the Python language to the Python language environment.
9. An electronic device, comprising:
A memory for storing a computer program;
A processor for implementing the steps of a calling method between the Python language and the c++ language according to any one of claims 1 to 5 when said computer program is executed.
10. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, which when executed by a processor, implements the steps of a method for calling between Python and c++ languages according to any one of claims 1 to 5.
CN202410057974.7A 2024-01-15 2024-01-15 Calling method and product between Python language and C++ language Pending CN118113381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410057974.7A CN118113381A (en) 2024-01-15 2024-01-15 Calling method and product between Python language and C++ language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410057974.7A CN118113381A (en) 2024-01-15 2024-01-15 Calling method and product between Python language and C++ language

Publications (1)

Publication Number Publication Date
CN118113381A true CN118113381A (en) 2024-05-31

Family

ID=91209610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410057974.7A Pending CN118113381A (en) 2024-01-15 2024-01-15 Calling method and product between Python language and C++ language

Country Status (1)

Country Link
CN (1) CN118113381A (en)

Similar Documents

Publication Publication Date Title
CN110198247B (en) Interface test method and system
EP3731161A1 (en) Model application method and system, and model management method and server
CN114528044B (en) Interface calling method, device, equipment and medium
CN113553257B (en) Test method, device, storage medium and electronic equipment
CN112817657B (en) Application program starting item loading method, device, system and storage medium
CN108023905B (en) Internet of things application system and method
CN110062035A (en) A kind of http request method and apparatus based on deque
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
CN111158777B (en) Component calling method, device and computer readable storage medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN116781586A (en) gRPC flow analysis method, device, equipment and medium
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN118113381A (en) Calling method and product between Python language and C++ language
CN116298340A (en) Product defect detection method and system based on task scheduling
CN113791777B (en) Picture display method and device, computer readable storage medium and electronic equipment
CN114035804A (en) Code conversion method, device, medium and electronic equipment
CN113704079B (en) Protobuf-based interface testing method and device
CN110262841A (en) The method and apparatus that a kind of pair of bytecode is enhanced
CN111309323B (en) Parameter initialization method and device and electronic equipment
CN114301970A (en) Service calling method and device, electronic equipment and storage medium
CN113761588A (en) Data verification method and device, terminal equipment and storage medium
CN113138767A (en) Code language conversion method, device, electronic equipment and storage medium
CN112162755A (en) Data processing method, device, medium and electronic equipment
CN113515300B (en) Code viewing method, device, electronic equipment and storage medium
CN110489469B (en) Data transmission method, device, computer equipment and storage medium

Legal Events

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