Python tutorials

Discover bpython: A Python REPL With IDE-Like Features

The standard Python interpreter lets you run scripts from files or interactively execute code on the fly in a so-called read-evaluate-print loop (REPL). While this is a powerful tool for exploring the language and discovering its libraries through instant feedback on your code inputs, the default REPL shipped with Python has several limitations. Luckily, alternatives like bpython offer a much more programmer-friendly and convenient experience. You can use bpython to experiment with your code or quickly test an idea without […]

Read more

Build Cross-Platform GUI Apps With Kivy

These days, developers are highly likely to be working on a mobile or web application. Python doesn’t have built-in mobile development capabilities, but you can create mobile applications by using libraries like Kivy, PyQt, or even Beeware’s Toga library. These libraries are all major players in the Python mobile space. However, there are some benefits that you’ll enjoy if you choose to create mobile applications with Kivy. Not only will your application look the same on all platforms, but you […]

Read more

Natural Language Processing With spaCy in Python

If you want to do natural language processing (NLP) in Python, then look no further than spaCy, a free and open-source library with a lot of built-in capabilities. It’s becoming increasingly popular for processing and analyzing data in the field of NLP. Unstructured text is produced by companies, governments, and the general population at an incredible scale. It’s often important to automate the processing and analysis of text that would be impossible for humans to process. To automate the processing […]

Read more

Generate Images With DALL·E 2 and the OpenAI API

Describe any image, then let a computer create it for you. What sounded futuristic only a few years ago has become reality with advances in neural networks and latent diffusion models (LDM). DALL·E by OpenAI has made a splash through the amazing generative art and realistic images that people create with it. OpenAI now allows access to DALL·E through their API, which means that you can incorporate its functionality into your Python applications. You’ll need some experience with Python, JSON, […]

Read more

Python Basics: File System Operations

So far, you’ve written programs that get their input from one of two sources: the user or the program itself. Program output has been limited to displaying some text in IDLE’s interactive window. These input and output strategies aren’t useful in several common scenarios, such as when: The input values are unknown while writing the program. The program requires more data than a user can be expected to type in by themselves. Output must be shared with others after the […]

Read more

Python’s “in” and “not in” Operators: Check for Membership

Python’s in and not in operators allow you to quickly determine if a given value is or isn’t part of a collection of values. This type of check is common in programming, and it’s generally known as a membership test in Python. Therefore, these operators are known as membership operators. In this tutorial, you’ll learn how to: Perform membership tests using the in and not in operators Use in and not in with different data types Work with operator.contains(), the […]

Read more

How to Get and Use the Current Time in Python

Getting the current time in Python is a nice starting point for many time-related operations. One very important use case is creating timestamps. In this tutorial, you’ll learn how to get, display, and format the current time with the datetime module. To effectively use the current time in your Python applications, you’ll add a few tools to your belt. For instance, you’ll learn how to read attributes of the current time, like the year, minutes, or seconds. To make the […]

Read more

It’s time to stop using Python 3.7

Upgrading to new software versions is work, and work that doesn’t benefit your software’s users. Users care about features and bug fixes, not how up-to-date you are. So it’s perhaps not surprising how many people still use Python 3.7. As of December 2022, almost 30% of packages downloaded from PyPI were for Python 3.7. This includes automated downloads as part of CI runs, so it doesn’t mean 3.7 is used in 30% of applications, but that’s still a lot of […]

Read more
1 49 50 51 52 53 185