How to Iterate Through a Dictionary in Python

Dictionaries are one of the most important and useful built-in data structures in Python. They’re everywhere and are a fundamental part of the language itself. In your code, you’ll use dictionaries to solve many programming problems that may require iterating through the dictionary at hand. In this tutorial, you’ll dive deep into how to iterate through a dictionary in Python. Solid knowledge of dictionary iteration will help you write better, more robust code. In your journey through dictionary iteration, you’ll […]

Read more

Click and Python: Build Extensible and Composable CLI Apps

You can use the Click library to quickly provide your Python automation and tooling scripts with an extensible, composable, and user-friendly command-line interface (CLI). Whether you’re a developer, data scientist, DevOps engineer, or someone who often uses Python to automate repetitive tasks, you’ll very much appreciate Click and its unique features. In the Python ecosystem, you’ll find multiple libraries for creating CLIs, including argparse from the standard library, Typer, and a few others. However, Click offers a robust, mature, intuitive, […]

Read more

Replacing a String in Python

If you’re looking for ways to remove or replace all or part of a string in Python, then this course is for you. You’ll be taking a fictional chat room transcript and sanitizing it using both the .replace() method and the re.sub() function. In Python, the .replace() method and the re.sub() function are often used to clean up text by removing strings or substrings or replacing them. In this tutorial, you’ll be playing the role of a developer for a […]

Read more

Build a Code Image Generator With Python

If you’re active on social media, then you know that images and videos are popular forms of content. As a programmer, you mainly work with text, so sharing the content that you create on a daily basis may not seem intuitive. That’s where a code image generator can come in handy for you! With a code image generator, you can create a nice-looking image of your code snippets. That way, you can share code without worrying about formatting, different syntax […]

Read more

Python Polars: A Lightning-Fast DataFrame Library

Now that you’ve installed Polars and have a high-level understanding of why it’s so performant, it’s time to dive into some core concepts. In this section, you’ll explore DataFrames, expressions, and contexts with examples. You’ll get a first impression of Polars syntax. If you know other DataFrame libraries, then you’ll notice some similarities but also some differences. Getting Started With Polars DataFrames Like most other data processing libraries, the core data structure used in Polars is the DataFrame. A DataFrame […]

Read more

Process Images Using the Pillow Library and Python

When you look at an image, you see the objects and people in it. However, when you read an image programmatically with Python or any other language, the computer sees an array of numbers. In this video course, you’ll learn how to manipulate images and perform basic image processing using the Python Pillow library. Pillow and its predecessor, PIL, are the original Python libraries for dealing with images. Even though there are other Python libraries for image processing, Pillow remains […]

Read more

What Are Python Asterisk and Slash Special Parameters For?

Whenever you think of Python’s asterisk operator (*), you most likely think of multiplication or exponentiation. Similarly, you probably associate the forward slash operator (/) with division. But you can also use the bare asterisk and slash as special parameters in function headers. These do something completely unrelated to mathematics. When defining functions, you’ll often include a list of comma-separated parameters to define what types of arguments the user can pass to your function. Using the asterisk and forward slash […]

Read more

Prompt Engineering: A Practical Example

You’ve used ChatGPT, and you understand the potential of using a large language model (LLM) to assist you in your tasks. Maybe you’re already working on an LLM-supported application and read about prompt engineering, but you’re unsure how to translate the theoretical concepts into a practical example. Your text prompt instructs the LLM’s responses, so tweaking it can get you vastly different output. In this tutorial, you’ll apply multiple prompt engineering techniques to a real-world example. You’ll experience prompt engineering […]

Read more

What Does if __name__ == “__main__” Mean in Python?

You’ve likely encountered Python’s if __name__ == “__main__” idiom when reading other people’s code. You might have even used if __name__ == “__main__” in your own scripts. But did you use it correctly? This line of code can seem a little cryptic, so don’t fret if you’re not completely sure what it does, why you might want it, and when to use it. In this video course, you’ll learn all about Python’s if __name__ == “__main__” idiom. What’s Included: Downloadable […]

Read more

Python News: What’s New From July 2023

It’s always a good month to be a Pythonista, but July 2023 really drove this point home! The release of a new Python 3.12 beta version and Cython 3.0 moved the language forward, and more change is on the way with the steering council’s announcement that a no-GIL CPython is in the works. Development in the Python world is a collective effort, with big contributions coming not from only the core developers but also everyday programmers. Sharing ideas is key […]

Read more
1 89 90 91 92 93 913