Product docs and API reference are now on Akamai TechDocs.Search product docs. Search for “” in product docs.Search API reference. Search for “” in API reference.
results matching
results
Python is one of the world’s most widely used programming languages, widely adopted in web development, data science, and embedded systems. Python’s formal syntax is somewhat open, as it permits a considerable range of styles. This allows programmers to indent, punctuate, and name according to their personal preferences.
Programs often need to look for, read, and write specific files in a special location. By convention, and with support from the operating system, programs maintain a current working directory used as the context for many of their files. There may also be fixed directories and files that are special to the program, such as the configuration files for editors and IDEs.
Many applications use temporary files to hold intermediate results in their execution. A program, for example, may process several gigabytes of data in multiple passes because trying to hold it all in memory can exceed the ability of the system, even with a large swap store. This is true when multiple copies of an application are running. Holding all the data in memory can slow down the application because the virtual memory system has to keep paging data in and out of working memory. When the application is finished with the temporary files, it’s a good idea to delete that working file, to free up the disk space.
Pythons sets are unordered collections modeled on mathematical sets, in which elements are unique. Python sets support the logical operations of mathematical sets, like union, intersection, and difference. This example code declares a new set and adds the elements of a second set to it, showing that the updated set contains unique elements:
Variables are what make programs capable of meaningful action and complexity. Understandably, you want to know how they work for any language you are working with.
Stacks are convenient data structures, collecting items in a last-in-first-out order like you see with many activity histories. But you may be wondering how exactly stacks work. Or you may be curious how you can start implementing a stack in Python.
Knowing about Python’s data types helps to make your Python programs more effective, and helps you to avoid errors. This guide covers the most useful Python data types, providing knowledge of their fundamentals and giving a cheat sheet that you can refer to.
Python is one of the most popular programming languages due to its ease of use and a large selection of built-in features. This guide describes the basic concepts behind Python, including how to install and use Python modules. It also explains how to write and run a Python script.
Most of the time, using Unicode characters in Python does not require extra effort. However, sometimes encoding and decoding do not work properly, which results in errors. To resolve these issues, this guide helps you understand how Python encodes and decodes Unicode. Fortunately, the Python library includes some powerful and useful utilities and built-in functions to manage these tasks. This guide introduces Unicode and the UTF-8 character encoding and explains how Python handles Unicode. It also discusses some common Python Unicode errors and demonstrates how to resolve them.
Lua and Python are often mentioned as good choices for embedded scripting languages. Both are interpreted, dynamically typed programming languages implemented in C. Both support procedural, object-oriented, and functional programming. Both are easy to learn compared to compiled, strongly typed, non-garbage-collected languages. This guide explores each language and the differences between them, so you can choose which is a better fit for your applications.
Python reigns as one of the most popular programming languages, with a wide range of programs and developer tools relying on it. In fact, your system likely already has at least one version of Python installed.
The Markdown markup language is a good choice for text formatting. Unfortunately, the Markdown syntax does not align with HTML conventions. Without further modification, Markdown can only be shared as plain text. The Python-Markdown library is an open source Python module that converts Markdown text into standards-compliant HTML markup. This guide explains how to install and use the Python-Markdown module and provides some background information about it.
Python arrays provide an effective way to store multiple values of the same type in a single variable. In this tutorial, you learn what Python arrays are and how to use them, and the difference between Python lists and arrays. You also learn how to loop through an array, add and remove elements from an array, and how to combine the values stored in different arrays.
In Python, queues are frequently used to process items using a first in first out (FIFO) strategy. However, it is often necessary to account for the priority of each item when determining processing order. A queue that retrieves and removes items based on their priority as well as their arrival time is called a priority queue. Prioritization can be complicated, but fortunately Python priority queues can be easily and efficiently implemented using a built-in module. This guide introduces the Python priority queue and explains how to implement it in Python 3.
Python is a dynamically typed language, so programmers might not always consider the type of each variable they create. However, the type of a variable is often important, and it might be necessary to convert it to another data type. This guide explains how typecasting works and illustrates how to convert data types in Python. It covers several common examples, such as how to convert an integer to a string.
During string interpolation a string literal is evaluated and if any placeholders are present, they are substituted by the indicated variable values. String interpolation helps reduce repetition in code and allows for dynamic string substitution. Python string interpolation consists of two parts: a string template and a value, or set of values, that you want to place within that template. To trigger string interpolation, the compiler needs some method of determining where to place the values within the string template. Python provides four techniques to do this, and this guide covers them all. Each string interpolation technique has its own advantages and disadvantages. The four ways to trigger string interpolation are the following:
Python supports several common string operations, like slicing, indexing, searching, and advanced formatting. However, it lacks a dedicated, built-in method for reversing strings. This guide shows you how to reverse a string in Python by leveraging Python’s tools for working with sequences.
A dictionary in Python is much like the dictionary you find online or the paper version you find on a shelf. It consists of a series of key-value pairs. A Python dictionary’s keys are used to retrieve a dictionary entry along with its value. The act of assigning a key to a value is called mapping, so a Python dictionary is a mapped data type. This guide introduces you to the Python 3 dictionary data type and shows you how to use dictionaries in your Python code.
Python is currently one of the world’s most popular programming languages. It achieved this position due to its powerful features, flexibility, and ease of use. This guide explains the pros and cons of Python and compares it to other languages. It also discusses the situations where Python is one of the best alternatives.
A tuple is a built-in Python data structure that stores multiple comma-separated values. Tuples are an immutable sequence type that can store values of any data type. A mix of different data types can also be stored in a tuple. This guide describes the characteristics of tuples and shows you the various ways you can create a Python tuple.
Boolean logic is at the heart of Python and most programming languages. It allows programmers to make comparisons, execute conditional statements, and implement common algorithms. The “greater than” (>) and “equals to” (==) symbols are examples of Python comparison operators, while and and or are some of Python’s logical operators. This tutorial explains Boolean logic and expressions and discusses how to use Python’s Boolean operators.
>
==
and
or
Programs often have to run the same commands over and over again. Python provides two types of loop statements to handle two different situations. The Python for loop is used when the number of iterations is known before the loop starts running. In contrast, the Python while loop repeats as long as a certain condition is true. This tutorial describes how to use both types of loops and explains how to use Python for common scenarios like looping through a dictionary.
for
while
Python programs must be able to run different branches of code in different situations. This is usually accomplished through the use of conditional statements, which determine the control flow through a program. Python’s if statement is used to decide whether or not some code should run. This guide explains the if statement and other Python conditionals and demonstrates how to use them.
if
Except for very short and simple programs, most Python applications contain code from many files, directories, and packages. Related functions and attributes are often grouped together as part of a Python module. A programmer can import this module and use its functions and variables in their application. This guide provides an introduction to Python modules and explains how to install and import modules in Python.
Python has become one of the world’s most popular programming languages due to its intuitive and straightforward nature. Among its attractive features is a powerful library for parsing and processing string objects. Python provides tools for indexing strings and creating substrings from larger strings, which is known as slicing. This tutorial discusses how to use Python string indexing and how to slice a string in Python.
Python is a dynamically typed language. It determines data types at run time, rather than compile time. Some examples of Python types include integers, floats, strings, and boolean. Dynamically typed languages stand in contrast to statically typed languages, like C++, Java, and Fortran, that perform type checking at compile time.
The Python unittest library helps you test your application code for errors in an automated way. It’s one of the testing methods discussed in our guide, An Overview of Python Testing Frameworks for Unit Testing. Mock testing is especially useful while your code is yet to be completed and your development is progressing. It performs continuous testing during development and provides good insights into how an application might ultimately function. This guide shows you how to use the Python unittest library to create mock objects to test your code.
Artificial Intelligence (AI), the appearance or simulation of human intelligence within a machine, is popular today because it can solve a huge number of problems within specific categories using well-known algorithms. Machine Learning (ML) is a sub-category of AI that depends on large datasets to affect the computations of algorithms to allow a generalized result that an application can apply to unseen data. In other words, ML provides an experience-based method to use AI techniques to solve problems realistically. Python ML features handle the required amounts of data effectively, and offer access to a broad range of algorithms using libraries like scikit-learn and SciPy to solve the various ML problem categories. Python’s capabilities deliver in a manner that is understandable in AI Python code, and which reduces the learning curve that most developers face.
Web development began as a process for structuring static content using HTML to make it easier to exchange. Adding style with CSS came next so that a web page could provide appealing content. These web pages were static and people wanted more. Web development is well beyond these simple beginnings today. Sometimes it’s hard to know when you’re using a web application or a desktop application, or a combination of the two. There are so many possibilities for content and presentation that it’s hard to know what to choose in the way of web programming languages. However, if you review what you want to do and why you want to do it, the choice of web programming languages quickly diminishes. The website programming language you choose affects what sorts of web design coding you can do.
This guide shows you how to install PyTorch, a Python framework, on an Ubuntu 20.04 Linode. PyTorch provides support for a variety of math-intensive applications that run on GPU and CPU hardware. Linode offers dedicated CPU instances and GPU instances that you can use to run PyTorch-based projects.
Bokeh is an interactive visualization library that focuses on browser output. This guide introduces you to Bokeh with example code that creates line and bar graphs.
Flask is a Python micro-framework for building web applications and web APIs. The framework provides pared-down core functionality, however, it is highly extensible. This guide shows you how to use Flask to build a REST API that serves up information about different programming languages. The data information exposed by the API can also be referred to as a resource. The API’s data comes from Hillel Wayne’s research on influential programming languages. At the end of the guide, you have an API that allows clients to complete the following:
This guide provides an introduction to popular Python testing frameworks used to unit test software. Unit tests are automated tests that target and test specific areas of your code, like specific functions or methods. A unit test compares your code against the criteria defined within the test. Using unit testing while developing your code catches bugs, gaps, and regressions. This guide provides an overview of three popular Python testing frameworks; doctest, pytest, and unittest. The guide demonstrates how to implement unit tests for an example function using each testing framework.
Python includes many built-in methods and operations that help you manipulate lists. This guide shows you how to use the append(), insert(), and remove() built-in list methods. You also learn how to write a list comprehensions, and how to sort lists.
append()
insert()
remove()
When your Python program needs to run an external password-dependent program, or access a remote server, use Paramiko. Paramiko is a Python module that implements the SSHv2 protocol. Paramiko is not part of Python’s standard library, although it’s widely used. This guide shows you how to use Paramiko in your Python scripts to authenticate to a server using a password and SSH keys.
FastAPI automatically generates an OpenAPI schema that can be accessed by your API’s users. The documentation generated by the OpenAPI schema helps users learn about your API’s features. This guide introduces how FastAPI creates documentation from your code. It also shows you how to provide custom information related to your API, if necessary. For example, you may want to modify an endpoint’s description or label a field as deprecated.
gRPC is an open-source remote procedure call (RPC) framework that enables cross-platform and cross-language communication between clients and a central server. gRPC allows for the specification of a common interface or API to define shared functions, constants, and message types. The server implements the full interface, while clients use stub functions to call the methods in the API. Client and server applications can be written in one of several supported programming languages, which do not have to necessarily match up. This guide introduces and explains gRPC, and describes how to implement an application with remote function calls using gRPC and Python.
Python 3.9.5 is the latest major release and contains several new features. Most of these new features focus on making existing features of the language easier to implement. The following sections describe some of the more stellar features, but you can be sure that there are plenty of others.
Python is one of the most popular programming languages in the world because it provides a vast array of packages, it’s easy to learn, and it’s incredibly flexible. The data science community has adopted Python as one of its go-to programming languages, because of the many packages that help analyze and visualize large datasets. This guide discusses the strengths and use cases for the top five Python data science packages.
Python was developed in the late 1980s, released in 1991, and is an interpreted, high-level and general-purpose programming language that emphasizes code readability. Python 3, released in 2008, is the current version.
Pylint is a code analysis tool to identify errors in Python source code. Specifically, Pylint helps programmers improve their code quality and style. The coding style that Pylint uses is PEP8.
FastAPI is a high-performance Python micro-framework designed to help developers build APIs quickly. Out-of-the-box, it generates interactive API documentation powered by the Swagger UI. This Python framework is minimal by default, but can be configured, and extended to fit your API’s use case.
As one of the most popular programming languages, the Python ecosystem offers a variety of frameworks to help you build a web API. You may need to build an API to serve data to a mobile application, a frontend website, or a machine learning project. Your project may only require routing functionality provided by a framework, or it may require an admin interface and a templating system, as well. Which framework you choose depends on your specific use case. To help you choose a Python framework, this guide provides an overview on some well-known Python frameworks used to build APIs and discusses their differences and strengths.
FastAPI is a modern Python micro-framework with all the functionality to support production applications. If you are building a REST API to serve data to an app, FastAPI is a good choice. It includes the following features that make it popular among developers:
Python is a popular programming language created in 2000, by Guido van Rossum. It’s useful for writing everything from small scripts to full-scale software. Python is also a commonly adopted programming language by people entering into the field of software development. A lot of its popularity is based on Python’s high level of abstraction. This abstraction makes writing and reading the code easier than other languages.
Python is a programming language with a large library of third party modules, or packages. Python developers rely on third party packages to simplify problems when they are writing code. When you install third party Python packages to your machine, you typically use a repository, like Pypi. This repository contains packages that can, by default, be installed with Pip. Pip is a tool used to install Python packages, like Apt for Ubuntu, onto the host system.
A Python virtual environment is an isolated project space on your system that contains its own Python executable, packages, and modules. Your Python applications and projects often have their own specific dependencies. With a virtual environment you can manage each of your project’s distinct dependencies without having them interfere with each other. You can use the virtualenv tool to create a virtual environment on your system. This guide shows you how to use virtualenv to create and run a Python virtual environment on an Ubuntu 18.04 Linode.
Geographic Information system (GIS) based applications require a beautiful mapping experience for users. Stadia Maps provides digital mapping that you can easily and affordably integrate into your web or mobile applications. They offer hosted map tiles, offline map tiles, static maps, and a few other core products. If you would like to test their services, you can use a local development environment along with their free tier plan. For more details on pricing and service limits, see their pricing plans.
Flask is a light-weight web framework for Python that includes several utilities and libraries you can use to create a web application. After you have developed a Flask application in a local environment, you need to prepare the application’s production environment in order to run the application and serve it to the users of the application through the internet.
Pipenv is Python’s officially recommended package management tool. It combines the functionality of Pip and Virtualenv, along with the best features of packaging tools from other languages such as Bundler and NPM. This results in a simplified workflow for installing packages and managing virtual environments.
Strings are one of the most basic data types in Python, used to represent textual data. Almost every application involves working with strings, and Python’s str class provides a number of methods to make string manipulation easy.
str
A Python virtual environment is an isolated project space on your system that contains its own Python executable, packages, and modules. Your Python applications and projects often have their own specific dependencies. With a virtual environment you can manage each of your project’s distinct dependencies without having them interfere with each other. You can use the virtualenv tool to create a virtual environment on your system. This guide will show you how to use virtualenv to create and run a Python virtual environment on a CentOS 8 Linode.
A Python virtual environment is an isolated project space on your system that contains its own Python executable, packages, and modules. Your Python applications and projects often have their own specific dependencies. With a virtual environment you can manage each of your project’s distinct dependencies without having them interfere with each other. You can use the virtualenv tool to create a virtual environment on your system. This guide shows you how to use virtualenv to create and run a Python virtual environment on a Debian 10 Linode.
Bummer! The page you were looking for wasn't found. You can browse our articles or try searching.