© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
P. JoyceC and Python Applications https://doi.org/10.1007/978-1-4842-7774-4_5

5. Embedded Python

Philip Joyce1  
(1)
Crewe, UK
 

The C programming language has been in operation since the early 1970s and has been central to the development of computer software since then. The Python language is newer and can perform some functions that C does not. So, it is useful to be able to write a C program and have some Python code incorporated (embedded) into it. This is what this chapter will illustrate.

We’ll look at the following two levels of Python code that can be incorporated into a C program:
  • Call a simple Python string.

  • Call a Python program.

To embed the two levels ...

Get C and Python Applications: Embedding Python Code in C Programs, SQL Methods, and Python Sockets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.