Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I would like to know how can i connect between python file and c file.
I need to connect with them , so i can use functions from both files.
thanks for the help!
Basic stuff that changes across C and Python is data types. I used ctypes python module to achieve conversion. Once data types are converted/formatted properly for C, you may pass these as arguments to C functions. C apis can remain as it is and changes are required in py code.
Consider looking at https://docs.python.org/3/library/ctypes.html
I have an example code here: https://github.com/Vishwajith-K/snippets/tree/py-c/bitwisepy
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I'm Working on a program that takes in text from the user and then implements functionalities in the backend, kind of like an interpreter, I have the parser working amazingly in python but some of the backend capabilities I feel would do great on c. I have looked into CPython but I don't seem to understand how to do it if it's even possible at all. I'm just a beginner, if someone could guide that will be very helpful.
CPython is just an implementation of Python in the C programming language. If you want to incorporate C code, you can write extension modules documented here.
Check out this StackOverflow post as well.
Alternatively, write a C program, compile it, and then call it via the subprocess module documented here.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm looking for a way to create a function that takes two args, time and operation and it does the operation at the given time as an argument. The script should be running on a server and it reads the data from a Redis-like database. I'm trying to find a way to do that avoid using any other frameworks or non-standard packages. Have any idea about that?
See the library https://github.com/dbader/schedule and this example https://github.com/dbader/schedule/blob/master/docs/examples.rst#run-a-job-once
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I write course work and now I stops in a progrees of writing, I want to build application based on Python which can drow Flowcharts of any code(maybe not all but main languages is: Python, Pascal, c++).
On Python I know about Graphviz+Pyreverse, but this solution is only for Python code vizualization.
You already have a python solution.
For C++ use clang/llvm.
For pascal, first use a pascal → C translator, then hand it to clang.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am a beginner of python i didn't found any difference between function and module.it is said that module stores code even after shutting the shell off rather than function.but when i tried to do so it didn't work for me.SO what is the big deal of using a module rather than function in the programming
In programming, function refers to a segment that groups code to perform a specific task.
A module is a software component or part of a program that contains one or more routines.
That means, functions are groups of code, and modules are groups of classes and functions.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have written a code in Python. There is a part in the code that does integration which has a very high computation time. But the same integration takes very less time in C. I want to run that part in C (that will take some input) and use the output to run the other code in python. In other words, I have a very large code in python, of which I want to run a small part in C. Please tell me how to do that.
You are looking for the ctypes library.