Data processing method, equipment and medium
By transforming the function configuration library of the browser-side Python compiler and adding custom functions, the problem of insufficient support of the existing compiler is solved, achieving higher flexibility and applicability, and meeting business needs and user habits.
Patent Information
- Application Number
- CN202410774743.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-10-18
AI Technical Summary
The existing browser-side Python compiler Skulpt.js has limited support for Python, poor flexibility in use, and cannot meet the needs of business scenarios and user usage habits.
By transforming and adding the function configuration library of the browser-side Python compiler, a custom configuration library is generated, including custom input functions and file reading and writing functions, to improve the configurability and flexibility of the compiler and meet business needs and users. Habit.
It improves the flexibility and reusability of the browser-side Python compiler, enabling it to meet the needs of business scenarios, fit the user's usage habits, and improve the user experience.
Smart Images

Figure CN118796167A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data processing method, device, and medium. Background Art
[0002] With the development of computing technology and the demand for student education, online programming education platforms that can learn programming technology have become more and more popular, such as the Python online programming platform that is more suitable for novices to learn.
[0003] During the programming learning process of the Python online programming platform, users can enter the written Python code on the browser page. After clicking run, the browser side will convert the back-end-oriented Python code into front-end-oriented JavaScript code. After that, the browser side runs the converted JavaScript code to execute the corresponding instructions, and the running results of the Python code can be obtained and displayed. In the prior art, the Python online programming platform usually directly introduces the browser-side Python compiler Skulpt.js to support the conversion of Python code and JavaScript code. However, as an open source third-party syntax conversion tool, Skulpt.js has limited support for Python and poor flexibility. It cannot meet the usage requirements of business scenarios and does not conform to user usage habits.
[0004] Therefore, a data processing solution is needed that can improve the flexibility of using the browser's Python compiler and meet the usage requirements of business scenarios and user usage habits. Summary of the Invention
[0005] The present application provides a data processing method, device and medium to solve the technical problems that the existing browser-based Python compiler has poor flexibility, cannot meet the usage requirements of business scenarios, and does not conform to user usage habits.
[0006] In a first aspect, the present application provides a data processing method, comprising:
[0007] Receive a program execution instruction input by a user, wherein the program execution instruction includes the Python code to be executed;
[0008] According to the preset custom configuration library, execute the program function corresponding to the Python code to obtain and display the running result corresponding to the Python code;
[0009] The custom configuration library is obtained in the following manner:
[0010] Modifying a configuration function in a function configuration library corresponding to a Python compiler on the browser side to obtain a first custom function, wherein the first custom function includes a custom input function;
[0011] The custom configuration library is generated according to the first custom function and an additional second custom function, wherein the second custom function includes a file reading and writing function.
[0012] In a possible implementation, modifying the configuration function in the function configuration library corresponding to the browser-side Python compiler to obtain the first custom function specifically includes:
[0013] The input function in the function configuration library corresponding to the browser's Python compiler is modified and encapsulated to obtain a custom input function, so that the custom input function has the following functions:
[0014] When it is detected that the Python code runs into the input function, the preset blocking code is triggered to prevent the code from continuing to run until the running parameters input by the user are received;
[0015] After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window. The custom input pop-up window includes one or more of the following settings: input format verification settings, hidden settings, location settings, and website step navigation settings;
[0016] Receive the running parameters input by the user through the custom submission method, execute the callback function according to the running parameters, and continue to run the Python code. The custom submission method includes submitting with the Enter key and submitting with the Space key.
[0017] In a possible implementation, the file reading and writing function is obtained in the following manner:
[0018] Generate a file tree based on the addresses of each file in the local files of the terminal device;
[0019] Uploading each file in the local file to the cloud server, and generating a mapping relationship between the address of each file in the local file and the address in the cloud server;
[0020] Generate a file read and write function based on the file tree and the mapping relationship, so that the file read and write function has the following functions:
[0021] When it is detected that the Python code runs to the file reading and writing function, the address of the file to be read in the code in the file tree is determined;
[0022] Determine the address of the file to be read in the cloud server according to the address of the file to be read in the file tree and the mapping relationship;
[0023] According to the address of the file to be read in the cloud server, the file to be read is read, and the read content is written to a designated location according to a preset writing method.
[0024] In a possible implementation, the method further includes:
[0025] When it is detected that the Python code runs to an image drawing function, executing the corresponding image drawing function according to the modified image drawing function library built into the custom configuration library, so as to obtain and display the running result corresponding to the image drawing function;
[0026] The transformed image drawing function library is obtained in the following manner:
[0027] Modifying a drawing function in an image drawing function library built into the function configuration library to obtain a first modified function;
[0028] generating a transformed image drawing function library according to the first transformation function and the additional second transformation function;
[0029] Among them, for each transformation function, the function of the transformation function when running on the browser side is consistent with the function when running on the local Python side.
[0030] In a possible implementation, the modifying of the drawing function in the image drawing function library built into the function configuration library to obtain the first modified function specifically includes:
[0031] The position function and the speed function in the image drawing function library are modified to obtain a position modification function and a speed modification function, wherein the number of decimal places retained when the position modification function / speed modification function is executed on the browser side is consistent with the number of decimal places retained when the position modification function / speed modification function is executed on the local Python side;
[0032] The seal function in the image drawing function library is modified to obtain a seal modification function, wherein the seal modification function includes an ID self-increment function, and the seal modification function is used to output a function return value when running on a browser side, and adjust the function return value to a unique ID;
[0033] The interrupt function in the image drawing function library is modified to obtain an interrupt modification function, wherein the interrupt modification function is used to throw an exception when running on the browser side to interrupt the subsequent code execution;
[0034] Modifying the writing function in the image drawing function library to obtain a writing modification function, so that the writing modification function can normally draw text in a disabled animation mode;
[0035] Modifying the direction function in the image drawing function library to obtain a direction modification function, wherein the direction modification function is used to normally calculate the orientation angle when running on the browser side;
[0036] Modifying the fill function in the image drawing function library to obtain a fill modification function, wherein the fill modification function is used to perform color filling normally when running on a browser side;
[0037] Performing correlation modification on the correlation functions of the position transformation function, and / or the speed transformation function, and / or the seal transformation function, and / or the interruption transformation function, and / or the writing transformation function, and / or the direction transformation function, and / or the filling transformation function to obtain a correlation transformation function;
[0038] A first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, and the association transformation function.
[0039] In a possible implementation, the method further includes:
[0040] The input function in the image drawing function library is transformed and encapsulated to obtain an input transformation function, so that the input transformation function has the following functions:
[0041] When detecting that the Python code runs to the input function of the image drawing function library, triggering a preset blocking code to prevent the code from continuing to run until the running parameters input by the user are received;
[0042] After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window. The custom input pop-up window includes one or more of the following settings: input format verification settings, hidden settings, location settings, and website step navigation settings;
[0043] Receive the running parameters input by the user through a custom submission method, execute the callback function according to the running parameters, and continue to run the Python code; the custom submission method includes submitting with the Enter key and submitting with the Space key;
[0044] Accordingly, the first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, and the association transformation function, including:
[0045] A first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, the association transformation function, and the input transformation function.
[0046] In a possible implementation, the additional second transformation function is obtained in the following manner:
[0047] Adding a color mode function to the image drawing function library, the color mode function is used to switch the input parameter form when setting the brush color;
[0048] Modifying the function associated with the color mode function in the image drawing function library so that the color association function obtained after the modification is functionally compatible with the color mode function;
[0049] Adding a mouse click function and a screen click function to the image drawing function library, and modifying the release function in the image drawing function library to obtain a release modification function, so that the mouse click function, the screen click function, and the release modification function support different mouse buttons when running on the browser side to the same degree as the support for different mouse buttons when running on the local Python side;
[0050] An additional second transformation function is generated according to the color mode function, the color association function, the mouse click function, the screen click function and the release transformation function.
[0051] In a second aspect, the present application provides a terminal device, including:
[0052] A receiving module is used to receive a program execution instruction input by a user, wherein the program execution instruction includes the Python code to be executed;
[0053] A processing module is used to execute the program function corresponding to the Python code according to a preset custom configuration library to obtain and display the running result corresponding to the Python code; wherein, the custom configuration library is obtained in the following manner: the configuration function in the function configuration library corresponding to the browser-side Python compiler is modified to obtain a first custom function, and the first custom function includes a custom input function; according to the first custom function and the added second custom function, the custom configuration library is generated, and the second custom function includes a file reading and writing function.
[0054] In a third aspect, the present application provides another terminal device, comprising: a processor, and a memory communicatively connected to the processor;
[0055] The memory stores computer-executable instructions;
[0056] The processor executes the computer-executable instructions stored in the memory to implement the above method.
[0057] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the above-mentioned method when executed by a processor.
[0058] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which implements the above method when executed by a processor.
[0059] The data processing method, device and medium provided by the present application can receive a program running instruction input by a user, and the program running instruction includes the Python code to be run; according to the preset custom configuration library, the program function corresponding to the Python code is executed to obtain and display the running result corresponding to the Python code; wherein the custom configuration library is obtained in the following manner: the configuration function in the function configuration library corresponding to the browser-side Python compiler is modified to obtain a first custom function, and the first custom function includes a custom input function; according to the first custom function and the added second custom function, a custom configuration library is generated, and the second custom function includes a file reading and writing function. The method of the present application improves the configurability of the browser-side Python compiler by performing function modification and function addition on the function configuration library corresponding to the existing browser-side Python compiler. The programmer can flexibly configure the functions in the browser-side Python compiler according to the specific business scenario, thereby greatly improving the flexibility of the use of the browser-side Python compiler, so that the browser-side Python compiler can not only meet the use requirements of the business scenario, but also fit the user's usage habits, thereby improving the reusability of the browser-side Python compiler. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0061] Figure 1 This is a flow chart of a data processing method according to an embodiment of the present application;
[0062] Figure 2 A flowchart of a data processing method according to another embodiment of the present application;
[0063] Figure 3 A schematic diagram of a custom input function calling process according to an embodiment of the present application;
[0064] Figure 4 This is a schematic diagram of the data processing process according to an embodiment of the present application;
[0065] Figure 5 This is a flow chart of a data processing method according to another embodiment of the present application;
[0066] Figure 6 This is a flow chart of a data processing method according to another embodiment of the present application;
[0067] Figure 7 This is a schematic diagram of the structure of a terminal device according to an embodiment of the present application;
[0068] Figure 8 This is a structural diagram of a terminal device according to another embodiment of the present application.
[0069] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0070] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0071] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0072] It should also be noted that the data processing method, device and medium of the present application can be used in the computer field, and can also be used in any field other than the computer field, such as the education field, etc. The application field of the data processing method, device and medium of the present application is not limited.
[0073] First, let’s explain the terms involved in this application:
[0074] Python, a computer programming language, was designed by Guido van Rossum at the Netherlands National Research Center for Mathematics and Computer Science in the early 1990s as a replacement for a language called ABC. Python provides efficient high-level data structures and simple, effective object-oriented programming, making it applicable to any scientific field. It supports diverse programming approaches and is also widely used in web development, artificial intelligence, and image processing. Its versatility makes Python suitable for the back-end of web applications.
[0075] JavaScript, a computer programming language (abbreviated as JS), is a lightweight, function-first, interpreted or just-in-time compiled programming language. Although best known as a scripting language for web page development, it is also used in many non-browser environments. JavaScript is a prototype-based, multi-paradigm dynamic scripting language that supports object-oriented, imperative, declarative, and functional programming paradigms.
[0076] Skulpt.js, an open source third-party syntax conversion tool, can convert Python code to JavaScript code.
[0077] The Turtle library is a very popular function library for drawing images in the Python language. Imagine a little turtle, starting at the origin of a coordinate system with the horizontal axis as x and the vertical axis as y, (0,0). It moves in this plane coordinate system according to a set of function instructions, thereby drawing graphics on its crawling path.
[0078] The data processing method, device, and medium of the present application can be applied to scenarios of Python online programming learning, and any related scenarios involving the conversion of Python code and JavaScript code can be applied to the data processing method, device, and medium.
[0079] When learning Python programming on online programming platforms, users can enter their Python code into a browser page. After clicking "Run," the browser converts the back-end Python code into front-end JavaScript. The browser then runs the converted JavaScript code to execute the corresponding instructions, generating and displaying the results of the Python code. Conventional Python online programming platforms typically use the browser-based Python compiler Skulpt.js to support the conversion between Python and JavaScript code.
[0080] However, as an open source third-party syntax conversion tool, Skulpt.js has limited support for Python and poor flexibility. It cannot meet the usage requirements of business scenarios and does not conform to user usage habits.
[0081] Based on this technical problem, the inventive concept of this application is: how to provide a data processing method that can improve the flexibility of the browser-side Python compiler and meet the usage requirements of business scenarios and user usage habits.
[0082] Specifically, it can receive program running instructions input by the user, and the program running instructions include the Python code to be run; according to the preset custom configuration library, the program function corresponding to the Python code is executed to obtain and display the running result corresponding to the Python code; wherein the custom configuration library is obtained in the following manner: the configuration function in the function configuration library corresponding to the browser-side Python compiler is modified to obtain a first custom function, and the first custom function includes a custom input function; according to the first custom function and the added second custom function, a custom configuration library is generated, and the second custom function includes a file reading and writing function. The method of the present application improves the configurability of the browser-side Python compiler by performing function modification and function addition on the function configuration library corresponding to the existing browser-side Python compiler. The programmer can flexibly configure the functions in the browser-side Python compiler according to the specific business scenario, thereby greatly improving the flexibility of the use of the browser-side Python compiler, so that the browser-side Python compiler can not only meet the use requirements of the business scenario, but also fit the user's usage habits, thereby improving the reusability of the browser-side Python compiler.
[0083] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0084] Example 1
[0085] Figure 1 This is a flow chart of a data processing method according to an embodiment of the present application. This embodiment describes the data processing method with the execution subject being a terminal device. Figure 1 As shown, the data processing method may include the following steps:
[0086] S101: Receive a program execution instruction input by a user, where the program execution instruction includes Python code to be executed.
[0087] In this embodiment, the user can enter the Python code to be run in the Python code editor on the browser page of the Python online programming platform, and after completing the input, click the run button to input the program running instruction to the terminal device to instruct the browser to run the Python code.
[0088] In this embodiment, the terminal device can be any user-end electronic device such as a computer or a tablet that can load the Python online programming platform.
[0089] S102: Execute the program function corresponding to the Python code according to the preset custom configuration library to obtain and display the running result corresponding to the Python code.
[0090] In this embodiment, Figure 2 This is a flow chart of a data processing method according to another embodiment of the present application. Figure 2 As shown, the custom configuration library in step S102 above can be obtained in the following ways:
[0091] S11: Modify the configuration function in the function configuration library corresponding to the browser-side Python compiler to obtain a first custom function, where the first custom function includes a custom input function.
[0092] S12: Generate a custom configuration library according to the first custom function and the added second custom function, where the second custom function includes a file reading and writing function.
[0093] In this embodiment, the browser-side Python compiler is an open source third-party syntax conversion tool in the prior art. The configuration functions in the function configuration library corresponding to the browser-side Python compiler are configuration functions fixed by the developer. It has limited support for Python and poor flexibility in use. It cannot meet the usage requirements of business scenarios and does not conform to user usage habits.
[0094] In this embodiment, the first custom function can be a custom function modified from an existing configuration function. The first custom function is not limited to custom input functions; any custom function modified from an existing configuration function can serve as the first custom function. The second custom function can be a newly created custom function not included in the existing function configuration library. The second custom function is not limited to file read / write functions; any newly created custom function not included in the existing function configuration library can serve as the second custom function.
[0095] In this embodiment, the custom input function can be obtained by modifying the original input function in the function configuration library corresponding to the browser-side Python compiler.
[0096] In this embodiment, the configurability of the browser-side Python compiler is improved by modifying and adding functions to the function configuration library corresponding to the existing browser-side Python compiler. Programmers can flexibly configure the functions in the browser-side Python compiler according to specific business scenarios, thereby greatly improving the flexibility of using the browser-side Python compiler. The browser-side Python compiler can not only meet the usage requirements of business scenarios, but also conform to the user's usage habits, thereby improving the reusability of the browser-side Python compiler.
[0097] In one possible implementation, the modification of the configuration function in the function configuration library corresponding to the browser-side Python compiler in step S11 to obtain the first custom function may include:
[0098] The input function in the function configuration library corresponding to the browser's Python compiler is modified and encapsulated to obtain a custom input function, so that the custom input function has the following functions:
[0099] A1: When the Python code is detected running into the input function, the preset blocking code is triggered to prevent the code from continuing to run until the running parameters entered by the user are received.
[0100] A2: After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window. The custom input pop-up window includes one or more of the following settings: input format verification settings, hiding settings, location settings, and website step navigation settings.
[0101] A3: Receives the running parameters entered by the user through a custom submission method, executes the callback function based on the running parameters, and continues to run the Python code. Custom submission methods include submitting with the Enter key and submitting with the Spacebar.
[0102] In this implementation, when Python code is detected running into an input function, the browser's Python compiler's corresponding function configuration library triggers a pop-up window to automatically block the Python code from running. The user can then enter parameters in the pop-up window and submit them. The browser then receives the input parameters and executes the subsequent code based on the sequence of the input parameters. However, existing browser pop-up window methods are not configurable, and the input content cannot be verified. This not only may lead to input errors, but also cannot meet the needs of various business scenarios and does not conform to the usage habits of different users.
[0103] In this embodiment, the input format verification setting can be used to set the format verification of the operating parameters input by the user; the hidden setting can be used to set whether to hide the input pop-up window; the position setting can be used to set the position of the input pop-up window; the website step navigation setting can be used to set the relevant settings for navigating the steps of input parameters or other steps.
[0104] In this embodiment, the settings of the customized input pop-up window are not limited to input format verification settings, hidden settings, location settings, and website step navigation settings. Those skilled in the art can flexibly set them according to various requirements of the input pop-up window, and no restrictions are made here.
[0105] In this embodiment, the customized submission method is not limited to the Enter key submission and the Space key submission. Those skilled in the art can flexibly set it, and no limitation is made here.
[0106] For example, you can create a custom input function called skInput on the web to listen for user input in the terminal area and return a promise. This skInput function can then be passed to the Skulpt.js library via the webMethods configuration option, reshaping the input function and using the Sk.misceval.Suspension method to block the code and wait for user input. The specific flow of input listening is as follows: the user runs the code, which pauses when it reaches the input function, executes skInput to wait for user input, and then returns the input as a promise resolve callback to Skulpt.js, which then executes the subsequent Python code. Because the input function is customizable and configurable, it can be modified to suit any business scenario. For example, if you want to open a custom popup window when Python reaches the input function, you can write your custom skInput internal logic to return a promise that executes the popup window opening logic and waits for user input. After the user enters the input, the promise resolves and returns the input content. In short, in the returned promise, you can perform any operations that conform to business logic.
[0107] For example, Figure 3 This is a schematic diagram of a custom input function calling process according to an embodiment of the present application. Figure 3As shown, programmers first encapsulate a custom input function in a custom configuration library. When a user enters the Python code to be executed in the Python code editor on the browser page of the Python online programming platform and clicks Run, the Python code is converted to JavaScript code and executed. When JavaScript code is detected running into the input function, calling the custom input function is treated as blocking the code using the Sk.misceval.Suspension method and waiting for user input parameters. After the user enters the execution parameters, the input content is returned through resolve, and the subsequent code is executed according to the execution parameters.
[0108] In this embodiment, programmers can pre-configure custom input functions based on specific business scenarios or specific user usage habits, so that when the custom input function is triggered, it no longer blocks subsequent code execution by automatically popping up a window, but blocks subsequent code execution by blocking code. Based on this, the input pop-up window can be customized, such as format verification settings, hidden settings, location settings, website step navigation settings, etc., to meet the needs of different business scenarios and different users, greatly improving the flexibility of input settings. Furthermore, the way users submit input operating parameters can also be customized to meet the needs of different users, further improving the flexibility of input settings.
[0109] In a possible implementation, the file reading and writing function in step S12 may be obtained in the following manner:
[0110] S21: Generate a file tree according to the addresses of the files in the local files of the terminal device.
[0111] S22: Upload each file in the local file to the cloud server, and generate a mapping relationship between the address of each file in the local file and the address in the cloud server.
[0112] S23: Generate a file read and write function based on the file tree and the mapping relationship, so that the file read and write function has the following functions:
[0113] B1: When it is detected that the Python code runs to the file reading and writing function, the address of the file to be read in the code in the file tree is determined.
[0114] B2: Determine the address of the file to be read in the cloud server according to the address of the file to be read in the file tree and the mapping relationship.
[0115] B3: Read the file to be read according to its address in the cloud server, and write the read content to the designated location according to the preset writing method.
[0116] In this embodiment, those skilled in the art can flexibly set the cloud server. For example, the cloud server can be Alibaba Cloud or Huawei Cloud, and no limitation is made here.
[0117] In this embodiment, when it is detected that the Python code runs to the file read / write function, the Python code is paused before calling the file read / write function to read a specific file and before reading the file to be read.
[0118] In this embodiment, the specific method of reading the file to be read can be flexibly set by those skilled in the art and written into the file reading and writing function, without any restriction here; similarly, the preset writing method can also be flexibly set by those skilled in the art and written into the file reading and writing function, without any restriction here.
[0119] For example, you can first use the "File Resource Management" function on the browser-side online programming website to upload local files to the cloud (Alibaba Cloud OSS), associate the local file path with the OSS file address, and finally pass the association relationship to Skulpt through the workspace; at the same time, pass in webMethods.skFetch as the method for reading file contents in the File class, and webMethods.skWriteFile as the method for writing file contents in the File class. At the same time, add internal methods to the File class to keep consistent with Python's functions, such as close, read, readline, write, etc., to enrich the integrity of the File class and improve the functions of the original Python File as much as possible on the web page. At this point, the implementation of the File class for reading local files in Python has been converted into a function for reading file resources on the website online. skFetch and skWriteFile can also be customized according to business scenarios.
[0120] For example, Figure 4 This is a schematic diagram of the data processing process of an embodiment of the present application, as shown in FIG. Figure 4As shown, after the user enters the Python code to be run in the Python code editor on the browser page of the Python online programming platform and clicks Run, when the platform detects that the Python code runs to the input function, it triggers the custom input function in the custom configuration library to execute and call back the custom input function; when the platform detects that the Python code runs to the file read and write function, it triggers the file read and write function in the custom configuration library to execute and call back the file read and write function (use the workspace in the file read and write function to obtain the file, use skFetch to execute and call back the file reading, and use skWriteFile to execute and call back the file writing).
[0121] In this embodiment, because the browser cannot directly access files stored on the user's local computer based on the file path for security reasons, when setting up the file read and write functions, each file in the local file system can be uploaded to the cloud server, and a mapping relationship is generated between the address of each file in the local file system and the address on the cloud server. Finally, the file read and write functions are generated based on the file tree and the mapping relationship. With this setup, when the Python code is detected running into the file read and write function, the address of the file to be read in the cloud server can be simply and accurately determined by using the address mapping relationship between the file to be read in the file tree in the code, thereby completing the file read and write operation.
[0122] Example 2
[0123] Figure 5 This is a flow chart of a data processing method according to another embodiment of the present application. This embodiment describes the data processing method with the execution subject being a terminal device. Figure 5 As shown, the data processing method may include the following steps:
[0124] S201: When it is detected that the Python code runs to the image drawing function, the corresponding image drawing function is executed according to the modified image drawing function library built into the custom configuration library to obtain and display the running result corresponding to the image drawing function.
[0125] In this embodiment, Figure 6 This is a flow chart of a data processing method according to another embodiment of the present application. Figure 6 As shown, the transformed image drawing function library in the above step S201 can be obtained by the following methods:
[0126] S31: Transform the drawing function in the image drawing function library built into the function configuration library to obtain a first transformed function.
[0127] S32: Generate a transformed image drawing function library according to the first transformation function and the added second transformation function.
[0128] For each transformed function, the function when the transformed function is running on the browser is consistent with the function when it is running on the local Python.
[0129] In this embodiment, the image drawing function library built into the function configuration library may be a Turtle library built into Skulpt.js.
[0130] In this embodiment, the first transformation function may be a function transformed from an existing drawing function. Any function transformed from an existing drawing function may serve as the first transformation function. The second transformation function may be a newly created function that is not included in the existing image drawing function library. Any newly created function that is not included in the existing image drawing function library may serve as the second transformation function.
[0131] In this embodiment, the Turtle library is an image drawing function library built into Skulpt.js. The default Turtle library has defects such as incompatibility of some methods and inconsistency between operation and native environment, which results in inconsistency between the function of calling the function in the Turtle library and the function of the function when running in the local Python runtime. This makes the content learned by the user using the Python online programming platform inconsistent with the content generated by the local Python runtime, affecting the user's cognition. Therefore, the drawing function in the image drawing function library built into the function configuration library can be modified and added, so that the function of the modified first modification function and the added second modification function when running on the browser side is consistent with the function when running in the local Python runtime. Through such a setting, the content learned by the user using the Python online programming platform is consistent with the content generated by the local Python runtime, improving the user experience.
[0132] In a possible implementation, the above step S31 transforms the drawing function in the image drawing function library built into the function configuration library to obtain a first transformed function, which may include:
[0133] S41: The position function and the speed function in the image drawing function library are modified to obtain a position modification function and a speed modification function. The number of decimal places retained when the position modification function / speed modification function is run on the browser side is consistent with the number of decimal places retained when the position modification function / speed modification function is run on the local Python side.
[0134] S42: The seal function in the image drawing function library is modified to obtain a seal modification function, where the seal modification function includes an ID auto-increment function. The seal modification function is used to output a function return value when running on the browser side and adjust the function return value to a unique ID.
[0135] S43: The interrupt function in the image drawing function library is modified to obtain an interrupt modification function, where the interrupt modification function is used to throw an exception when running on the browser side to interrupt the subsequent code execution.
[0136] S44: Modify the writing function in the image drawing function library to obtain a writing modification function, so that the writing modification function can normally draw text in the animation disabled mode.
[0137] S45: Transforming the direction function in the image drawing function library to obtain a direction transformation function, where the direction transformation function is used to normally calculate the orientation angle when running on the browser side.
[0138] S46: Modify the fill function in the image drawing function library to obtain a fill modification function, which is used to perform color filling normally when running on the browser side.
[0139] S47: Modify the association function of the position transformation function, and / or the speed transformation function, and / or the seal transformation function, and / or the interruption transformation function, and / or the writing transformation function, and / or the direction transformation function, and / or the filling transformation function to obtain the association transformation function.
[0140] S48: Generate a first transformation function based on the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, and the association transformation function.
[0141] In this embodiment, the number of decimal places retained when the original position function position and speed function speed are running on the browser side is inconsistent with the number of decimal places retained when running in local Python. Therefore, the position function position and the speed function speed can be modified so that the number of decimal places retained when the position modification function / speed modification function is running on the browser side is consistent with the number of decimal places retained when running in local Python.
[0142] The original stamp function stamp will not generate a return value when running on the browser side, but will generate a return value when running in local Python. Therefore, the stamp function stamp can be modified by adding an id auto-increment function so that the stamp modification function can output the function return value when running on the browser side, and adjust the function return value to a unique ID.
[0143] The original interrupt function bye will interrupt the execution of subsequent code when running in the local Python, but this logic is not implemented when running on the browser side. Therefore, the interrupt function bye can be modified so that the interrupt modification function can throw an exception when running on the browser side to interrupt the execution of subsequent code.
[0144] The original writing function "write" cannot draw text content normally when running on the browser side in animation-disabled mode, but can draw text content normally when running in local Python in animation-disabled mode. Therefore, the writing function "write" can be modified so that the writing function can draw text normally in animation-disabled mode.
[0145] The original direction function seth has normal calculation logic when running in local Python, but an error occurs in the calculation logic when running in the browser, resulting in an error in angle calculation and rotation direction calculation. Therefore, the direction function seth can be modified so that the direction modification function can calculate the heading angle normally when running in the browser.
[0146] The original fill function fill fills colors normally when running in local Python, but the color filling is partially missing when running on the browser. Therefore, the fill function can be modified so that the fill modification function can fill colors normally when running on the browser.
[0147] In this embodiment, the associated function of each transformed function may be a function that has a functional relationship with the original function of the transformed function.
[0148] In this embodiment, functions in the default Turtle library that have functional defects when running on the browser side can be modified accordingly, such as the position function, speed function, seal function, interrupt function, writing function, direction function, and fill function, so that the functions of the modified functions when running on the browser side are consistent with those when running on the local Python. Furthermore, in order to ensure compatibility between the functions in the modified image drawing function library, it is also necessary to modify the associated functions of the modified functions accordingly, further improving the user experience of the modified image drawing function library.
[0149] In one possible implementation, the method may further include:
[0150] The input function in the image drawing function library is transformed and encapsulated to obtain an input transformation function, so that the input transformation function has the following functions:
[0151] C1: When it is detected that the Python code runs into the input function of the image drawing function library, the preset blocking code is triggered to prevent the code from continuing to run until the running parameters input by the user are received.
[0152] C2: After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window. The custom input pop-up window includes one or more of the following settings: input format verification settings, hidden settings, location settings, and website step navigation settings.
[0153] C3: Receives the running parameters entered by the user through a custom submission method, executes the callback function according to the running parameters, and continues to run the Python code. Custom submission methods include submitting with the Enter key and submitting with the Space key.
[0154] Accordingly, the above step S48 generates a first transformation function based on the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, and the association transformation function, which may include:
[0155] A first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, the association transformation function, and the input transformation function.
[0156] In this embodiment, the input format verification setting can be used to set the format verification of the operating parameters input by the user; the hidden setting can be used to set whether to hide the input pop-up window; the position setting can be used to set the position of the input pop-up window; the website step navigation setting can be used to set the relevant settings for navigating the steps of input parameters or other steps.
[0157] In this embodiment, the settings of the customized input pop-up window are not limited to input format verification settings, hidden settings, location settings, and website step navigation settings. Those skilled in the art can flexibly set them according to various requirements of the input pop-up window, and no restrictions are made here.
[0158] In this embodiment, the customized submission method is not limited to the Enter key submission and the Space key submission. Those skilled in the art can flexibly set it, and no limitation is made here.
[0159] In this embodiment, the specific process of modifying and encapsulating the input function in the image drawing function library to obtain the modified input function is described in detail in Example 1, where the input function in the function configuration library corresponding to the browser's Python compiler is modified and encapsulated to obtain the custom input function. This description is omitted here. The functionality of the modified input function is the same as that of the custom input function in Example 1.
[0160] In this embodiment, the input functions in the image drawing function library are modified and encapsulated. The original input functions input, textinput, and numberinput are modified, and the underlying function call relationships of the original functions are reconstructed and uniformly changed into the custom input functions (input modification functions) in Example 1.
[0161] In this embodiment, programmers can pre-configure the input transformation function according to specific business scenarios or specific user usage habits, so that when the input transformation function is triggered, it no longer blocks subsequent code execution by automatically popping up a window, but blocks subsequent code execution by blocking code. Based on this, the input pop-up window can be customized, such as format verification settings, hidden settings, location settings, website step navigation settings, etc., to meet the needs of different business scenarios and different users, greatly improving the flexibility of input settings. Furthermore, the way users submit input operating parameters can also be customized to meet the needs of different users, further improving the flexibility of input settings.
[0162] In a possible implementation, the second transformation function added in step S32 may be obtained in the following manner:
[0163] S51: Add a color mode function to the image drawing function library. The color mode function is used to switch the input parameter format when setting the brush color.
[0164] S52: modifying the function associated with the color mode function in the image drawing function library so that the color association function obtained after the modification is compatible with the color mode function.
[0165] S53: Add a mouse click function and a screen click function to the image drawing function library, and modify the release function in the image drawing function library to obtain a release modification function, so that the degree of support for different mouse buttons by the mouse click function, the screen click function and the release modification function when running on the browser side is consistent with the degree of support for different mouse buttons when running on the local Python side.
[0166] S54: Generate an additional second transformation function according to the color mode function, the color association function, the mouse click function, the screen click function and the release transformation function.
[0167] In this implementation, the original Turtle library does not have a color mode function colormode. The input format for setting the brush color on the browser side is fixed and cannot be switched. Therefore, a new colormode function can be added to the Turtle library to switch the input format when setting the brush color. For example, when configured to 1, it allows the use of strings such as red to configure the color. When configured to 255, it allows the use of hexadecimal or RGB parameters to configure the color.
[0168] In addition, after adding the colormode function, the pencolor, fillcolor, color, dot, bgcolor and other functions in the Turtle library that are functionally related to the colormode function are also modified to make them compatible with the colormode function.
[0169] In this implementation, the original Turtle library does not have the mouse click function onclick or the screen click function onscreenclick, but only the release function onrelease. Therefore, we can add the onclick and onscreenclick functions to the Turtle library, and set the support level of the onclick, onscreenclick, and onrelease functions for different mouse buttons when running on the browser to be consistent with the support level of different mouse buttons when running on the local Python runtime.
[0170] In this embodiment, a color mode function can be added to the image drawing function library to switch the input parameter form when setting the brush color, thereby improving the user experience. Furthermore, a mouse click function and a screen click function can be added to the image drawing function library so that the support level of the mouse click function, the screen click function, and the release transformation function for different mouse buttons when running on the browser side is consistent with the support level of different mouse buttons when running on the local Python side, thereby further improving the user experience. Furthermore, when adding a second transformation function, if there is a function associated with the function of the second transformation function, the associated function also needs to be modified accordingly to make the functions of each function in the image drawing function library compatible.
[0171] The data processing method of the present application is described below with reference to a specific embodiment.
[0172] Example 3
[0173] In a specific embodiment, a user is learning programming on a Python online programming platform. The specific data processing process of the Python online programming platform is as follows:
[0174] In the first step, the Python online programming platform pre-modifies and encapsulates the input function in the function configuration library corresponding to the browser's Python compiler according to the specific business scenario to obtain a custom input function; and adds a custom input function to the function configuration library.
[0175] In the second step, the user can enter the Python code to be run in the Python code editor on the browser page of the Python online programming platform, and after entering, click the run button to input the program running instructions to the terminal device.
[0176] In the third step, the terminal device receives the program execution instruction input by the user and executes the program function corresponding to the Python code according to the preset custom configuration library to obtain and display the corresponding execution result of the Python code. Specifically, when the terminal device detects that the Python code has run to the input function, it triggers the preset blocking code to prevent the code from continuing to run until the running parameters entered by the user are received; after preventing the code from continuing to run, the terminal device displays a custom input pop-up window on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window; receives the running parameters entered by the user through the custom submission method, executes the callback function according to the running parameters, and continues to run the Python code.
[0177] In the fourth step, when the terminal device detects that the Python code runs to the file reading and writing function, it determines the address of the file to be read in the code in the file tree; based on the address of the file to be read in the file tree and the mapping relationship, it determines the address of the file to be read in the cloud server; based on the address of the file to be read in the cloud server, it reads the file to be read and writes the read content to the specified location according to the preset writing method.
[0178] In the fifth step, when the terminal device detects that the Python code runs to the image drawing function, it executes the corresponding image drawing function according to the modified image drawing function library built into the custom configuration library to obtain and display the corresponding running result of the image drawing function.
[0179] Figure 7 This is a schematic diagram of the structure of a terminal device according to an embodiment of the present application. Figure 7As shown, the terminal device includes: a receiving module 71 for receiving a program running instruction input by a user, wherein the program running instruction includes the Python code to be run; a processing module 72 for executing the program function corresponding to the Python code according to a preset custom configuration library to obtain and display the running result corresponding to the Python code; wherein the custom configuration library is obtained in the following manner: the configuration function in the function configuration library corresponding to the browser's Python compiler is modified to obtain a first custom function, wherein the first custom function includes a custom input function; a custom configuration library is generated according to the first custom function and the added second custom function, wherein the second custom function includes a file reading and writing function. In one embodiment, the description of the specific implementation functions of the terminal device can be found in steps S101-S102 in Example 1 and step S201 in Example 2, which will not be repeated here.
[0180] Figure 8 This is a schematic diagram of the structure of a terminal device according to another embodiment of the present application. Figure 8 As shown, the terminal device includes: a processor 101, and a memory 102 communicatively connected to the processor 101; the memory 102 stores computer execution instructions; the processor 101 executes the computer execution instructions stored in the memory 102 to implement the steps of the data processing method in the above-mentioned method embodiments.
[0181] In the above-mentioned terminal device, the memory 102 and the processor 101 are electrically connected directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines, such as a bus connection. The memory 102 stores computer-executable instructions for implementing the data access control method, including at least one software function module that can be stored in the memory 102 in the form of software or firmware. The processor 101 executes various functional applications and data processing by running the software programs and modules stored in the memory 102.
[0182] The memory 102 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory 102 is used to store programs, and the processor 101 executes the programs after receiving execution instructions. Furthermore, the software programs and modules in the memory 102 may also include an operating system, which may include various software components and / or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
[0183] The processor 101 can be an integrated circuit chip with signal processing capabilities. The processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0184] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the steps of each method embodiment of the present application.
[0185] An embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of each method embodiment of the present application when executed by a processor.
[0186] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.
[0187] It should be further noted that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0188] It should be understood that the above-described device embodiments are merely illustrative, and the device of the present application may also be implemented in other ways. For example, the division of units / modules in the above-described embodiments is merely a logical functional division, and actual implementations may employ other division methods. For example, multiple units, modules, or components may be combined or integrated into another system, or some features may be omitted or not implemented.
[0189] In addition, unless otherwise specified, the functional units / modules in the various embodiments of the present application may be integrated into a single unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The aforementioned integrated units / modules may be implemented in the form of hardware or software program modules.
[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a particular embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined in any way. To keep the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0191] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered merely as exemplary, and the true scope and spirit of the present application are indicated by the appended claims.
[0192] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A data processing method, characterized in that: include: Receive a program execution instruction input by a user, wherein the program execution instruction includes a Python code to be executed; According to the preset custom configuration library, the program function corresponding to the Python code is executed to obtain and display the running result corresponding to the Python code; The custom configuration library is obtained in the following way: Modify the configuration function in the function configuration library corresponding to the Python compiler on the browser side to obtain a first custom function, wherein the first custom function includes a custom input function; The custom configuration library is generated according to the first custom function and an additional second custom function, wherein the second custom function includes a file reading and writing function.
2. The method according to claim 1, characterized in that: The configuration function in the function configuration library corresponding to the Python compiler on the browser side is modified to obtain the first custom function, specifically including: The input function in the function configuration library corresponding to the browser Python compiler is transformed and encapsulated to obtain a custom input function, so that the custom input function has the following functions: When it is detected that the Python code runs to the input function, the preset blocking code is triggered to prevent the code from continuing to run until the running parameters input by the user are received; After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window, and the custom input pop-up window includes one or more of the following settings: input format verification setting, hidden setting, location setting, website step navigation setting; Receive the running parameters input by the user through the custom submission method, execute the callback function according to the running parameters, and continue to run the Python code. The custom submission method includes submitting with the Enter key and submitting with the Space key.
3. The method according to claim 2, characterized in that The file reading and writing functions are obtained in the following way: Generate a file tree according to the addresses of each file in the local file of the terminal device; Uploading each file in the local file to the cloud server, and generating a mapping relationship between the address of each file in the local file and the address in the cloud server; Generate a file read and write function according to the file tree and the mapping relationship, so that the file read and write function has the following functions: When it is detected that the Python code runs to the file reading and writing function, the address of the file to be read in the code in the file tree is determined; Determine the address of the file to be read in the cloud server according to the address of the file to be read in the file tree and the mapping relationship; According to the address of the file to be read in the cloud server, the file to be read is read, and the read content is written to a designated location according to a preset writing method.
4. The method according to any one of claims 1 to 3, characterized in that Also includes: When it is detected that the Python code runs to the image drawing function, the corresponding image drawing function is executed according to the transformed image drawing function library built into the custom configuration library to obtain and display the running result corresponding to the image drawing function; The transformation image drawing function library is obtained by the following method: Transforming a drawing function in an image drawing function library built into the function configuration library to obtain a first transformed function; Generate a transformed image drawing function library according to the first transformation function and the added second transformation function; Among them, for each transformation function, the function of the transformation function when running on the browser side is consistent with the function when running in the local Python.
5. The method according to claim 4, characterized in that The step of modifying the drawing function in the image drawing function library built into the function configuration library to obtain a first modified function specifically includes: The position function and the speed function in the image drawing function library are modified to obtain a position modification function and a speed modification function, wherein the number of decimal places generated by the position modification function / speed modification function when running on the browser side is consistent with the number of decimal places generated when running on the local Python; The seal function in the image drawing function library is transformed to obtain a seal transformation function, wherein the seal transformation function includes an ID self-increment function, and the seal transformation function is used to output a function return value when running on a browser side, and adjust the function return value to a unique ID; The interrupt function in the image drawing function library is modified to obtain an interrupt modification function, wherein the interrupt modification function is used to throw an exception when running on the browser side to interrupt the subsequent code running; Modifying the writing function in the image drawing function library to obtain a writing modification function, so that the writing modification function can normally draw text in a disabled animation mode; Transforming the direction function in the image drawing function library to obtain a direction transformation function, wherein the direction transformation function is used to normally calculate the orientation angle when running on the browser side; Modifying the fill function in the image drawing function library to obtain a fill modification function, wherein the fill modification function is used to perform color filling normally when running on a browser side; Modify the correlation function of the position transformation function, and / or the speed transformation function, and / or the seal transformation function, and / or the interruption transformation function, and / or the writing transformation function, and / or the direction transformation function, and / or the filling transformation function to obtain a correlation transformation function; A first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function and the association transformation function.
6. The method according to claim 5, characterized in that Also includes: The input function in the image drawing function library is transformed and encapsulated to obtain an input transformation function, so that the input transformation function has the following functions: When it is detected that the Python code runs to the input function of the image drawing function library, a preset blocking code is triggered to prevent the code from continuing to run until the running parameters input by the user are received; After preventing the code from continuing to run, a custom input pop-up window is displayed on the browser page to prompt the user to enter the corresponding running parameters in the custom input pop-up window, and the custom input pop-up window includes one or more of the following settings: input format verification setting, hidden setting, location setting, website step navigation setting; Receive the running parameters input by the user through the custom submission method, execute the callback function according to the running parameters, and continue to run the Python code, the custom submission method includes Enter key submission and Space key submission; Correspondingly, the first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, and the association transformation function, including: A first transformation function is generated according to the position transformation function, the speed transformation function, the seal transformation function, the interruption transformation function, the writing transformation function, the direction transformation function, the filling transformation function, the association transformation function, and the input transformation function.
7. The method according to claim 6, characterized in that The second transformation function is obtained by the following method: Adding a color mode function in the image drawing function library, wherein the color mode function is used to switch the input parameter form when setting the brush color; Transforming the function associated with the color mode function in the image drawing function library so that the color association function obtained after the transformation is functionally compatible with the color mode function; A mouse click function and a screen click function are added to the image drawing function library, and a release function in the image drawing function library is modified to obtain a release modification function, so that the degree of support for different mouse buttons by the mouse click function, the screen click function and the release modification function when running on the browser side is consistent with the degree of support for different mouse buttons when running on the local Python side; An additional second transformation function is generated according to the color mode function, the color association function, the mouse click function, the screen click function and the release transformation function.
8. A terminal device, characterized in that: include: A receiving module, used to receive a program running instruction input by a user, wherein the program running instruction includes the Python code to be executed; A processing module is used to execute the program function corresponding to the Python code according to a preset custom configuration library to obtain and display the running result corresponding to the Python code; wherein the custom configuration library is obtained in the following manner: the configuration function in the function configuration library corresponding to the browser-side Python compiler is modified to obtain a first custom function, the first custom function includes a custom input function; the custom configuration library is generated according to the first custom function and an additional second custom function, the second custom function includes a file reading and writing function.
9. A terminal device, characterized in that: comprising a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
