appsec.fyi

A somewhat curated list of links to various topics in application security.

Python

LinkExcerpt
Python CybersecurityLearn how to build a simple Python script that can be used to scan for open ports on a network. This tutorial covers the implementation steps needed to build the script using Python Programming.
OWASP PygoatThe purpose is to give both developers and testers a platform for learning how to test applications and how to code securely. PyGoat is written in python and used Django web framework as a platform. It has both traditional web application vulnerabilities (i.e. XSS, SQLi) as well.
Understanding async Python for the webPublished: . Filed under: Django, Python. Recently Django 4.1 was released, and the thing most people seem interested in is the expanded async support.
Two Tips With Coding In Python Changed My LifeEvery day we want to know more about python to develop our knowledge until we reach the professional stage and I am sure there are a lot of things in python we didn’t see ever but this is not a drawback in our brain, this is what makes us learn and search about new things every day we wake up in,
A Practical 12-Week Course to Learn to Automate Stuff with PythonOne of the coolest things you can do with Python is automating tasks.
I Made a Python Bot to Send “Good Night” Texts to My GFHaving a functioning relationship is hard, especially when you’re a full-time coder. You have to take care of her and her needs all the time, and most importantly, if she is clingy, you have to send “Good night” texts every single night.
4 Ways To Annoy Your Colleagues With Your Python CodeHere are 4 ways to write your code that will make your software engineer colleagues go “what the hell?” and give them a massive headache. Let’s say we need to add a and b together.
Python Web development in 2022: Which web frameworks are the most popular by Github stars?TL;DR: Django is the most popular web framework with 65,687 stars. The second place is Flask with 60,217 and the newcomer is FastAPI with 44,121 on the third place. The above chart shows that Django is in the lead with over 5,000 Stars, but fastapi is grown strong.
This Is Why You Should Use Tortoise-ORM in Your Python ProjectsIntegrating relational databases into our code could be clunky, but it can be easier with ORM. In this article, I’ll introduce you all to a cutting-edge Python ORM package called tortoise ORM and give a hands-on example.
Python 3 Cheat SheetToday I gonna tell you how to enhance your level in python. Python is a powerful yet easy to use programming language developed by Guido van Rossum, first released over a decade ago in 1991. With Python, you can quickly write a small project.
4 books that will make you a python ninja .If you have stumbled to this post .. I can bet you love python … And when you love something you should take care of it . in this small blog post i have compiled a list of books that have helped me become a better python programmer .
RegEx in Python: Introduction and The use of BackslashLets say, you have sorted out the ways an email address can be written and also you have a list of thousands of email addresses which may or may not be valid.
6 More Things I Didn’t Know About Python Until RecentlyI’ve been programming in Python since 2017, and only knew of these in the past one year. Let’s say we have a complex data structure that we want to print eg. a multi-nested dictionary.
Python Decorators (made easy)Decorator can be used to send function as argument and it can return a function. Its mainly used for one function can be used in another function or many function. On example 1, Here on down calling you can we are passing one function on another function.
Class in Python : All you need to knowToday, we gonna introduce a fundamental principe in python: class. Class is everywhere, and almost all in python is a class, but first, we might take a look of what python is. Python is a high level language and an OOP language, an oriented object programming language.
Spice up your terminal with RichEver thought of bringing whatever you see on the browser to your console? I felt the need for the same when I was working on my pet (truly pet :)) project WagginTails. I was not a UI/UX person as it requires a lot of patience and perseverance, hence I prefer to work on the middle layer.
7 Useful Python Libraries You Should Use in Your Next ProjectWhy write custom functionality when a library can do it for you? Libraries are the best friends and life savors of developers. In my opinion, a good project makes use of some of the best libraries available.
Hidden powers of pydanticDiscover some key features of pydantic you may not be aware of. For those who don’t know pydantic, it is a library for data validation leveraging type annotations feature added in python3.5. Here is an example taken from the documentation.
Python Web Development Framework in 2022Did you know that as of 2022, the speediest programming language in the world is? Python! Yes, you guessed it correctly: it is the most popular, readable, and user-friendly software programming language for web development.
I Made A Python Cheat Sheet for Data Structures and Algorithms (Useful for Leetcode)Get a PDF of this sheet at the end of the article. Dictionaries are used to store data values in key:value pairs. Info about collections.Counter() available below.
Python Trick : functools.singledispatchYou might have seen code similar to the below example where you have to use multiple if-else statements inside your program to perform the different tasks based on the parameter type or condition. This pattern soon becomes tedious when the number of conditions and task functions starts to grow.
Advanced Python: Classes, Objects, and MROLearn about the inner workings of classes, objects, and MRO in Python 3.
Best Code Editors and IDE For Python DevelopersMuch of your experience as a developer will be determined by the programming language you use to write your code and A good integrated development environment (IDE) or Code Editor that can help you work more efficiently.
Python & Variables + Confusion About Memory AddressesVariables like in the previous article are names that represent a value stored in memory. So if we have variable, alpha and “I am human” in memory address id1009 then alpha represents id1009 which contains “I am human”. So that’s simple.
🤔 Python generators. When to use?Python generators is a really powerful tool that can help you optimize your code. But sometimes its impact is more useless than useful. Let’s have a look at some examples to figure in which cases it is better to use them…
10 Killer Automation Scripts For Your Daily StuffHaving your everyday task and work automated is an awesome way rather than doing it manually. Well for making it true this article presents you with 10 killer automation scripts that will automate your everyday task and problems. So put this article on your list and let's get started.
Fake webcam for your online meetings, with PythonPicture this. You’re in an online meeting, and for one reason or another you don’t really feel like putting your webcam on. But you see that everybody else has it on.
How to Create Callable Objects in Python: Python OOP Complete CourseHave you ever tried to call your class objects?? When you write your Python code, you can usually call your predefined functions and methods, but not your class objects.
Python features that I was unaware even existedI’ve just discovered a new hobby: leisurely reading Python documentation. When you read anything for pleasure, you often pick up on intriguing details that you may have otherwise overlooked. So, the following is a collection of facts that I found interesting. Can you perform that in Python?
These tools boost my development productivity while using my Mac, maybe it will help you tooMaccy is a simple yet essential tool for me. It is a clipboard manager that helps manage my copy and paste. I often do API testing in various environments, local, dev, and production. When it comes to API, copying and pasting the bearer token wasn’t the most pleasant thing to do.
I finally found the best note taking app after trying multiple apps within the past yearBefore I begin this article I want to say that in the past couple of months I have been switching apps every now and then with the hopes to find the best note-taking app. While trying these different apps I found out that within each of the app there was something that I was missing.
Sharing Code Using a setup.py File in PythonWhere both sub-projects and have a main.py file that use similar code. You (want to) store this shared code inside a utils.py file that sits in a third directory .
A Guide to Python Libraries For Pentesters, Ethical Hackers and System Administrators.Cybersecurity engineers and penetration tester largely depend upon Python to perform a wide range of tasks. Python is widely used for data science and machine learning applications.
yield fromWe now know what a generator is, how to send values to a generator, and how to close a generator. This article is looking at how we can have two-way communications using caller, sub-generator using yield from , yield and send. We know how we can generate and consume values. For eg.
10 Python Scripts to Automate Your Daily StuffGetting your stuff automated is an awesome way to save most of your time by manually doing them again and again. In this article, I present you with 10 Python scripts to automate your stuff. Well put this article on a list and let's get started.
Knowing These Python Techniques Helped me in 2022Python-like all other programming language is easier if we learn the Pythonic ways to do stuff. I have listed 10 Python techniques that a Python Developer should know. Let’s get started —
4 smart ways to write Python programDo you want to print “Hello World” without using print statement? Do you want to give multiple inputs in single line?
7 Useful Python Libraries You Should Use in Your Next ProjectWhy write custom functionality when a library can do it for you? Libraries are the best friends and life savors of developers. In my opinion, a good project makes use of some of the best libraries available.
Top IDE’s for Python in 2022Over the years, python has garnered a lot of publicity and popularity. According to Statista, over 48% of developers who took the survey use python as their programming language.
Functional Programming in PythonFunctional programming is a programming paradigm in which the primary method of computation is evaluation of only functions. In this tutorial, you’ll explore functional programming in Python. Functional programming typically plays a fairly small role in Python code.
The Impossible Web ScrapingTo do data science we need data, of course. But getting the data is not always an easy task. One way data scientists get data is through web scraping, which is the process of extracting data from a webpage. But some websites seem impossible to scrape, until we find a way to do it.
4 Python Questions Not Many Can Solve In One Line Of CodeHere are 4 questions that are usually easy to solve under normal circumstances, but get pretty difficult once we try to solve them in only one line of code. Note — I’ve tested them out before, and all 4 are definitely solvable in one line of code (just not easy). Good luck!
How to Protect Text Input from XML External Entity (XXE) Attacks using PythonEffective XML External Entity attacks look to interfere with your application’s processing of serialized data. Without a countermeasure to check XML text strings, such attacks can infect files and wreak havoc on your system internally.
Improve Python Class Performance with “__slots__"When we create an object from a class, the attributes of the object will be stored in a dictionary called __dict__. We use this dictionary to get and set attributes. It allows us to dynamically create new attributes after the creation of the object. Let’s create a simple class InventoryItem.
Whip up a stunning Dashboard with Python & Streamlit!Ever wanted to get a juicy dashboard that bedazzles people but don’t want to spend days on trying to center a div with css? Then you should go with Streamlit! Streamlit is an open-source Python library that makes it easy to create and share beautiful, custom web apps for showing your data.
7 Useful Python Libraries You Should Use in Your Next ProjectWhy write custom functionality when a library can do it for you? Libraries are the best friends and life savors of developers. In my opinion, a good project makes use of some of the best libraries available.
Four Tricks In Python You Don’t Knowbut what about if we want to get a list of the max numbers? this is the purpose of this article. let us keep goinig a little to see how to do it.
10 Python Scripts For Automating Your Everyday ProblemsAutomating your everyday tasks is an awesome way to save most of your time from doing them manually. Imagine the tasks you do manually like fetching movies from IMDB, editing PDF files, reading daily headlines, and many more.
Python : __init__ Vs __new__ !!In python classes you might have seen __new__ and __init__ . The __new__ is called a constructor function and __init__ is called an initializer function. The __new__() is a static method of the built-in python object class. When you define a new class, it implicitly inherits from the object class.
Python: Advanced Syntax of ClassCo-Author: Y. S. Huang, a master’s student studying AIVC and likes open-source, if you are interesting, go to check my Github! Last time we introduced some basic elements of class in python. This time we will focus on the class method and the different usage of the class.
An introduction to asyncio in pythonAsyncio is a tool for concurrent programming in python which is more light weight than threads and multi-processing. This works based on a event-loop which executes a collection of tasks and the significance is , these tasks have the liberty to choose when to yield control back to the event loop.
How and when to use __slots__ in pythonEach python object has a _dict_ attribute which is a dictionary containing all other attributes. E.g. when you type self.attr python is actually doing self.dict[‘attr’]. As you can imagine using a dictionary to store attribute takes some extra space & time for accessing it.
Python mmap: Doing File I/O With Memory MappingThe Zen of Python has a lot of wisdom to offer. One especially useful idea is that “There should be one—and preferably only one—obvious way to do it.” Yet there are multiple ways to do most things in Python, and often for good reason.
7 Things I Never Knew About Python Until RecentlyIn this Dog class, the __name attribute has a getter method but not a setter method. By right, we as users should only be able to read the __name attribute and not have permission to set a new name for our Dog object. But private variables are not that private.
Cleaner Python Code with PartialsI’ve been spending a lot of time lately trying to be lazy. It’s become my mantra as a data scientist: How can I do less work? In my quest for slacker nirvana I’ve discovered the concept of partial functions in Python.
Callable Protocol in PythonOne of the great strengths of Python is the expressive power it contains through its protocols. Have you ever come across a new class that allows its instances to be called like a function and at the same time have other functionalities that are not standard for “function” objects?
Python Web Development Framework in 2022Did you know that as of 2022, the speediest programming language in the world is? Python! Yes, you guessed it correctly: it is the most popular, readable, and user-friendly software programming language for web development.
Python 101 – How to Generate a PDFThe Portable Document Format (PDF) is a very popular way to share documents across multiple platforms. The goal of the PDF is to create a document that will look the same on multiple platforms and that will print the same (or very similar) on various printers.
Awesome PythonInspired by awesome-php. Libraries for administrative interfaces.
pikepdfPython + QPDF = "py" + "qpdf" = "pyqpdf", which looks like a dyslexia test. Say it out loud, and it sounds like "pikepdf". For users who want to build from source, see installation.
Solve Real World Problems Using PythonJoin 37988 Pythonistas and start coding ... Wether you aspire to become a web developer, data scientist, DevOps or cybersecurity engineer, good chance you will greatly benefit from being well versed in Python!
microsoft/picologgingStatus This project is an early-alpha. There are some incomplete features (see Issues). Picologging is a high-performance logging library for Python. picologging is 4-10x faster than the logging module in the standard library.
Your Guide to the CPython Source CodeAre there certain parts of Python that just seem magic? Like how are dictionaries so much faster than looping over a list to find an item.
Python Stacks, Queues, and Priority Queues in PracticeQueues are the backbone of numerous algorithms found in games, artificial intelligence, satellite navigation, and task scheduling. They’re among the top abstract data types that computer science students learn early in their education.
Deep Dive into Lambda Functions in PythonWhat is Lambda in PythonA lambda function in python is a Nameless Function, it has the Following properties:-It cannot be called again and used or can we pass any arguments into the function from another point of the codeit has no name , more clearly explaining it is an anonymous functiona Lambda fu
Python Requests Library Caused a Production OutageBefore I go into the outage you’ll need to understand parts of the project which include code and architecture. First the project pulled down data from various third party services generally making web requests to pull, parse and format data for submission.
Modern Functions in Python 3Python has thrived over the past few decades as the language which lets you work quickly and effectively. Like many modern companies, we use Python quite extensively for a majority of our stack, but in many cases, continue to live on Python 2.7. The harsh reality is that Python 2.
Run Your Python Code as Quickly as C++It is critical for my profession as an AI researcher to quickly code up a concept to check if it works or not. Python is a fantastic tool for doing precisely that. It helps you to concentrate on the concept rather than on boilerplate code and other boring tasks.
Python best practices.Writing an aesthetic, readable, and structured code is vital when you want to deploy your code into production. An unstructured, unreadable and unoptimized code is difficult to debug and is not accepted for deployment.
7 Pip Commands (Python) That Make Your Life EasierPip Installs Packages (PIP) is a Python package manager that allows us to install 3rd party libraries in Python. And pip will automatically install pandas for us. Here are 7 other Pip commands that I’ve found pretty useful in managing my Python installations.
DATETIME IN PYTHONDatetime is a library provided in python programming to access date and time. Generally datetime is denoted yyyy-mm-dd hh:mm:ss. There are two ways to call it: The difference in how to call the datetime above can be seen from the form of the datetime function call.
Python — 10 Common Beginner MistakesHow to recognize a Python Expert? The code should be working, lean & readable. Some of the below-listed mistakes are commonly made by Python Beginners. Well — they are not really mistakes, as the code still works— but they can be improved.
Python With An AsteriskPython is a popular programming language, used in a variety of applications, from data science to web development. It has many nice features, it’s easy to learn, and you can create a nice application with just a couple of lines.
Memory Management in PythonMemory management is the process of efficiently managing computer memory (RAM). It involves allocating a piece of memory at run-time to the program when the program requests it and freeing the allocated memory for re-use when the program no longer needs it.
Multithreaded HTTP requests in PythonThis will be a rather brief overview and benchmark of 2 different ways you can parallelize HTTP requests in Python. The complete code snippet can be found at the end of this article.
A Python project templateCreating a Python project is tiresome work. There are numerous repeated steps as creating setup.py, configuring MyPy, Pytests, and automating other stuff. Usually, you copy-paste everything from the previous project, modify it a little bit and make it work for the new project.
Intro to Webhooks and How to Receive them with PythonBefore talking about webhooks, let’s talk about APIs. Below is the data flow for an API. You make a GET/POST request to the API and you get a response back.
Best version of python: now can beat all languagesThe idea is to bring another update in python that will make it faster than all languages. Another version of python will also include efficient memory consumption, fast in mobile devices & easy to access database.
The single most useful Python Decorator @cachePython is well known for its simplicity and many resources that can help you. Not only do we have many different resources in our community but we also have a lot of helpful resources inside Python standard libraries.
Getting Started Debugging Python Apps in PyCharmGedalyah Reback is the Senior Product Marketing Manager at Rookout with experience explaining in plain language the deep technical aspects of digital technologies to non-technical and professional crowds. He is an avid blogger and lover of languages.
Context ManagersContext managers are an incredibly useful tool in Python. They allow you to create a block of code with defined variables that are defined in the block declaration.
Python Best PracticesBest practices for writing better code in Python. This blog will help the beginners in python to write efficient and neat code. Even if you are an intermediate level programmer in python, I do recommend you to go through this blog you may find some new tricks and tips.
Use Exceptions To Write Better Python ProgramsExceptions are usually raised when a program encounters an unexpected error. For example, if you divide by zero, or if you pass a string to a function that needed a number. But what are exceptions exactly? They are just objects, and they are all subclasses of the general Exceptionclass.
Python — Best Practices for Writing FunctionsWithout a doubt, functions are one of the most important concepts in Python. When doing coding, we break down big problems in the real world into small ones, and then process through functions. Functions are both the nemesis of repetitive code and the best weapon against code complexity.
5 Killer Python Scripts to Automate Your ProblemsDid you ever think about automating your daily routine task like Excel work, Creating Qr images of links, extract valuable data from PDF? Well in this article I present you with 5 killer Python scripts for automation. So sit back and let's get started.
Docstrings in PythonLet's talk about docstrings in Python. We wrote that message when we defined this function.
Multiprocessing in Python: The Complete GuideThe multiprocessing.Process class allows you to create and manage new child processes in Python. Although multiprocessing has been available since Python 2, it is not widely used, perhaps because of misunderstandings of the capabilities and limitations of threads and processes in Python.
Start Using Annotations In Your Python CodeThe programming languages such as C, C++, Java, etc. are statically typed languages meaning the data type of the variable must be declared before you can actually use it in your program.
Top Python Tricks That Will Boost Your SkillsPython is my favorite language from the start of my programming career. I always try to find shorthands and tricks to boost my skills and save time. I ended up searching on different tech forums and websites like StackOverflow and medium.
Automate WhatsApp Messages with Python in 3 StepsPython is probably one of the coolest languages. And this fascinating about it is that you can automate day-to-day tasks. One of such tasks we do every day is sending messages on WhatsApp.
How Using ‘yield’ Instead of ‘return’ Can Make Your Python Code FasterWhen we started learning Python, we were probably taught to use the return keyword in functions rather than yield. In this article, I’ll quickly demonstrate why sometimes using yield is better and can make your code run faster (especially when dealing with lots of data).
Databases with PythonLately, I’ve been studying Django, and I felt the necessity to improve my database skills. I’ve taken some introductory SQL courses, but I realized that I’m not comfortable with the thing.
How to check the type of something in PythonIn Python, you may want to check for the type of a variable or object. The result could definitely be of use for your coding, but is there such a thing in Python that’s simple and quick? Luckily, there is!
How to Build A Dashboard from Scratch in Python using StreamlitA Dashboard is a type of user interface which is used to have a visual representation of the relevant objective. The purpose of a dashboard is to simplify & streamline the data for the User.
Master Python ComprehensionsOne of the most significant advantages of Python is that it’s a highly expressive language. Without much boilerplate, developers can come up with elegant solutions that, if well structured, read like a story. Here lies the beauty of the language, well presented in the Zen of Python.
TryHackMe | Python BasicsIn this story I will be sharing my process of completing the “Python Basics” Room in TryHackMe. Tasks 1–5 include some basic steps such as printing “Hello World” and I’m sure you all will get through it easily. Lets start from task 6:
Setup a Ready-For-Production Python ProjectPython is one of the most used programming languages nowadays. It is very simple to set up, its syntax is quite user-friendly compared with Java, and has a lot of pre-built modules that can help to create machine learning algorithms. With Python, it’s very easy to build something that works.
Python Useful Regex Quick ReferenceMore content at plainenglish.io. Sign up for our free weekly newsletter here.
An Intro To HTTPXHttpx is a web client for Python that makes it easy to communicate with web servers. It supports multiple protocols, including HTTP, HTTPS, and FTP. It also supports authentication, including Basic and Digest authentication.
5 More Python One-liners You Should UseIn this installment, we’ll be exploring some really cool sections of Python code. These short one-liners solve a wide range of problems and can get you out of a jam if you’ve managed to program yourself into a corner.
Built-in Python functions map( ), filter( ) & reduce( ) , you should literally learn right now.These functions are commonly used in functional-style python programming. These functions are most often used in conjunction with the anonymous ( lambda ) function, but you can use it with a normal function which defines by ( def ) key word.
Logging in PythonThis article aims to outline the basics of logging and create a simple project that documents every event into a log file and later use this log file to analyze the errors.
10 Advanced Automation Scripts for Your Python ProjectsThis cool automation script will compress your images into lower sizes without changing their Quality. The script uses the Pillow module and its built-in ANTIALIAS function. This automation script will help you to download and view Instagram DP.
Hacking and Securing Python ApplicationsSecuring applications is not the easiest thing to do. An application has many components: server-side logic, client-side logic, data storage, data transportation, API, and more. With all these components to secure, building a secure application can seem really daunting.
PythonJonas A. In this tutorial, I’ll talk about how to send push notifications to yourself using Python and myNotifier.
5 Python Libraries That Will Help Automate Your LifeThink of all the repetitive tasks you do at work. You send emails, create Excel reportings, extract data from PDFs, and (if you’re a data scientist like me) do tons of data analysis. Nobody wants to do that, but in the end, someone has to do it.
Automate Your Life Using PythonThere is a common trope in software that you have to be an expert to be able to write programs and this is just not true. In 2022, Software has become an integral part of life and everyone can get a piece of the pie.
Malware extraction in Python with ScapyNetwork captures are common among security events. Malware present in any network communication can be easily extracted with tools like Wireshark. If you have many pcap files, how would you extract them all? Let’s walk through a script to extract PE Files from pcaps using Python and Scapy.
Async IO in Python: A Complete WalkthroughWatch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Hands-On Python 3 Concurrency With the asyncio Module
Context Managers and Python's with StatementThe with statement in Python is a quite useful tool for properly managing external resources in your programs.
6 Python Libraries For Cyber Security Professionals and Ethical HackersThe Python libraries ethical hackers swear by.Python is one of the most growing computer languages in recent times due to its easiness and demand. But Python also plays a very crucial role in Cyber Security. In this article, I will mention 6 libraries which can give you a brief idea about same.
How to Convert a String into a List in PythonWorking with a list in Python can be one of the most common tasks. However, not everything comes to you in the form of a list as input.
3 Awesome Python Libraries That You Should Know AboutA few days ago, I published a blog on 5 Python Libraries That You Don’t Know About, But Should. That blog had dozens of thousands of views in less than a week. Thus, I decided to write a part two with other cool libraries that you should try out.
7 Python Libraries to Make Automation EasyOften it’s hard to find inspiration to automate using Python. I think knowing packages might give you an idea of what to automate. In this article, I’ll talk about 7 Python packages that can inspire your next automation. Usually, when you want to automate something, you might come across APIs.
Understanding the Python GILDave Beazley's presentation from PyCon'2010 in Atlanta Georgia. This is a mirror of the original presentation hosted at http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2010-understanding-the-python-gil-82-3273690. David Beazley teaches intense in-person Python Programming and Computer Science
Brython: Python in Your BrowserIf you’re a web developer who prefers writing Python over JavaScript, then Brython, a Python implementation that runs in the browser, may be an appealing option. JavaScript is the de facto language of front-end web development.
Creating the Perfect Python DockerfileIncrease your python code performance and security without changing the project source code. Having a reliable Dockerfile as your base can save you hours of headaches and bigger problems down the road.
CPython InternalsIf you haven’t heard of before, it’s a “guided tour” to the internals of the Python 3 interpreter. You’ll pick up the concepts, ideas, and technicalities of CPython in an approachable and hands-on fashion:
Python monkey-patching like a bossIf you work in a big project, most likely you will meet situations, when you would like to change/improve used third-party library behaviour, and you try to modify it from your project. This is called monkey-patching and it is usually associated with something not obvious, which would like to avoid.
Replacing an imported module dependencyIs it possible to make CustomModule replace its use of somemodule for somefakemodule without changing its code? That is, from ClientCode. Python will find somemodule in sys.modules and return the cached module, somefakemodule.
Python sys.meta_path() ExamplesThe following are 30 code examples for showing how to use sys.meta_path(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
How to use sys.meta_path with Python 3.x?given is the one of the code snippet/ sample which we are using in my old application, I have to migrate this code from python2.7 to python3.7. If we run on python3 getting error as "KeyError: 'my_virtual_module'" but on python2 its giving an o/p "hello world".
100 Helpful Python Tips You Can Learn Before Finishing Your Morning CoffeePython is quite popular nowadays, mainly due to its simplicity, and easiness to learn. You can use it for a wide range of tasks like data science and machine learning, web development, scripting, automation, etc.
Python 201: An Intro to importlibPython provides the importlib package as part of its standard library of modules. Its purpose is to provide the implementation to Python’s import statement (and the __import__() function).
An Intro to Threading in PythonWatch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Threading in Python Python threading allows you to have different parts of your program run concurrently and can simplify your design.
Data Science Python TutorialsWhat is Python? Python is a common language for programming and scripting. It was created by Guido van Rossum and released in 1991.
The Best VS Code Extensions for Python Developers for 2021We listed the best VS extensions for JS developers. Now, it’s time we do so for the Python community. Same as before: I’m a PyCharm user, I love PyCharm, and I won’t probably be changing editors anytime soon.
Turn Photos into Cartoons Using PythonAs you might know, sketching or creating a cartoon doesn’t always need to be done manually. Nowadays, many apps can turn your photos into cartoons. But what if I tell you, that you can create your own effect with few lines of code?
21 Python Mini Projects With CodeI have been using python for the last 1 and a half year, and the things that I most like about python is its one-liners and packages. One thing that I realize that the best way to learn a programming language is to build projects in it. In this blog, we will see 21 python projects with code.
NumPy Illustrated: The Visual Guide to NumPyNumPy is a fundamental library that most of the widely used Python data processing libraries are built upon (pandas, OpenCV), inspired by (PyTorch), or can efficiently share data with (TensorFlow, Keras, etc). Understanding how NumPy works gives a boost to your skills in those libraries as well.
Welcome to Pyramid, a Python Web FrameworkPyramid makes it easy to write web applications. You can start small with this "hello world" minimal request/response web app. This may take you far, especially while learning. As your application grows, Pyramid offers many features that make writing complex software take less effort.
10 Surprisingly Useful Base Python FunctionsThose that work in Python often consider that maybe Python isn’t the star of the show here — but instead its brilliant ecosystem. Often whenever we are working with Python applications, we are working with a lot of dependencies.
5 Python Tricks You Should Start Using in 2021Start the New Year with one of the best New Year’s resolutions: Learn more Python. You can start with this article in which I present 5 Python tricks that will make your life easier.
Three Functions to Know in PythonThere are three functions in python that provide vast practicality and usefulness when programming. These three functions, which provide a functional programming style within the object-oriented python language, are the map(), filter(), and reduce() functions.
Accessing the Dark Web with PythonHello, Reader! In this article, you will learn how to install Tor and configure it in a way that will allow us to make requests with Python to the dark web via Tor’s SOCKS proxy (oooh).
Pocket-APIThis package provides a wrapper class around GetPocket V3 APIs. First, you have to Create your consumer key from getpocket's developer console. To get the access token, you have to authorize the app on your own account.
Python One-Liner →List ComprehensionIf you are using Python language, you should seriously look in to ways for writing efficient code by frequently using List Comprehension instead of for loops wherever applicable.
Everything Is an Object in Python — Learn to Use Functions as ObjectsYou’ve probably heard the saying that everything is an object in Python — one of the most popular object-oriented languages.
5 Python Tricks You Should KnowPython has such an amazing support network it can almost seem like there is too much to take in all at once. This is normal and should be recognised. It can be confusing for those starting out.
How to Write Pythonic LoopsOne of the easiest ways to spot a developer who has a background in C-style languages and only recently picked up Python is to look at how they loop through a list.
Introduction to Python SQL LibrariesAll software applications interact with data, most commonly through a database management system (DBMS). Some programming languages come with modules that you can use to interact with a DBMS, while others require the use of third-party packages.
How to Create a Reverse Shell in PythonThere are many ways to gain control over a compromised system, a common way is to gain interactive shell access, which enables you to try to gain full control of the operating system. However, most basic firewalls blocks direct remote connections.
3 Python list comprehension tricks you might not know yetIf you’ve used Python you’re probably familiar with the list comprehension syntax. Compare that to appending items to an empty list.
Python Descriptors: An IntroductionDescriptors are a specific Python feature that power a lot of the magic hidden under the language’s hood. If you’ve ever thought that Python descriptors are an advanced topic with few practical applications, then this tutorial is the perfect tool to help you understand this powerful feature.
A Python prompt into a running process: debugging with ManholeSometimes your Python process will behave strangely, run slowly, or give you the wrong answers. And while hopefully you have logging, the logging isn’t always enough. So how do you debug this process?
Python Flask Basics Part 1 - Static Home Page#python #flask #webdevelopment #coding #okaydexterPython Flask Basics Part 1 - Static Home Page In this series of videos i'll be showing you how can you start web development in python using flask library. In this video i'll get you through the basics of flask from installation to making a static ho
Remote Procedural Call via XML-RPC in 5 minutesOver the next 5 minutes, we'll bring you up to speed with how to implement XML-Remote Procedural Calls (XML-RPC) in Python 3 with the use of the built-in modules xmlrpc.server and xmlrpc.client.Make sure you don't stop watching until you've considered the security implications as well.Contents:0:00
Top 15 Python Web Development Frameworks to Use in 2019Python is now a mainstream programming language thanks to emerging technologies using Python heavily. Python web development requires the support of a framework to be quick, precise, and cost-effective. Let’s learn which top 15 Python frameworks are trendy in 2019.
Top 10 Best Python IDEs Used By Python Developers in 2019There are many online python IDE that supports easy-to-use, debug mode, code refactoring, graphical debugging, code analysis and many more features. Some of those are free python ide, python ide in mac, python ide on windows. IDE is known as Integrated Development Environment.
PGJones.dev
Vim Config Update: 2019 EditionI like to update my Vim configuration every 2-5 years just to make sure I am working with the latest and greatest version of Vim and that I’m doing things efficiently. Check out my full Vim Tutorial The last few upgrades I’ve been focused on one thing: simplicity.
What’s in your Pocket? Visualizing your Reading List with PythonLevel up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now BLOG Build the future of communications. Start building for free Build the future of communications. Start today with Twilio's APIs and services.
Has the Python GIL been slain?In early 2003, Intel launched the new Pentium 4 “HT” processor. This processor was clocked at 3 GHz and had “Hyper-Threading” Technology.
How to Extract Words from PDFs with PythonAs I mentioned in my previous article: How to Connect to Google Sheets with Python, I’ve been working with a client to help them parse through hundreds of PDF files to extract keywords in order to make them searchable.
The easy way to work with CSV, JSON, and XML in PythonWant to be inspired? Come join my Super Quotes newsletter. 😎 Python’s superior flexibility and ease of use are what make it one of the most popular programming language, especially for Data Scientists. A big part of that is how simple it is to work with large datasets.
The definitive guide to setup my Python workspaceHave you ever focused on a task, but then needed to execute some quick command to move on and it didn’t work because your workspace was a mess? When this happens you lose your flow and must first solve your tools’ problem, to then work on your original problem.
SQLAlchemyWe often encounter data as Relational Databases. To work with them we generally would need to write raw SQL queries, pass them to the database engine and parse the returned results as a normal array of records. SQLAlchemy provides a nice “Pythonic” way of interacting with databases.
Building Minimal Docker Containers for Python ApplicationsThis post was last updated September 19th, 2019. A best practice when creating Docker containers is keeping the image size to a minimum. The fewer bytes you have to shunt over the network or store on disk, the better.
The Why, When, and How of Using Python Multi-threading and Multi-ProcessingA wise and powerful wizard lives in a small village in the middle of nowhere. Let’s call him Dumbledalf. Not only is he wise and powerful, but he’s also happy to help anyone who asks and this means that people come from far and wide to ask the wizard for aid.
JSON — The Python WayJavaScript Object Notation (JSON) is a lightweight data-interchange format based on the syntax of JavaScript objects. It is a text-based, human-readable, language-independent format for representing structured object data for easy transmission or saving.
Create a Twitter Bot in Python Using TweepyWith about 15% of Twitter being composed of bots, I wanted to try my hand at it. I googled how to create a Twitter bot and was brought to a cleanly laid out web app. It allowed you to create a bot that would like, follow, or retweet a tweet based on a keyword.
Python List Comprehensions in 5-minutesPython List Comprehensions in 5-minutesA visual introduction to those tricky Pythonic one-linersDaniel BourkeFeb 9, 20195 min read·Just show me the code! Quick link: Jupyter Notebook on GitHubWhy would you want to do a Python list comprehension?To save lines of code.
Build Simple Restful Api With Python and Flask Part 2In this article I will show you how to build simple restful api with flask and SQLite that have capabilities to create, read, update, and delete data from database. Similar with my article on part 1(https://medium.
How I used Python to analyze Game of ThronesI wanted to learn Python for a long time, but I could never find a reason. When my company had a bunch of daily reports that needed to be generated, I realized I had an opportunity to explore Python to cut out all the repetition.
Write Better Python FunctionsIn Python, like most modern programming languages, the function is a primary method of abstraction and encapsulation. You’ve probably written hundreds of functions in your time as a developer. But not all functions are created equal.
An Introduction to Clustering Algorithms in PythonIn data science, we often think about how to use data to make predictions on new data points. This is called “supervised learning.” Sometimes, however, rather than ‘making predictions’, we instead want to categorize data into buckets. This is termed “unsupervised learning.”
Python Virtual Environments made easyI was starting a project where I had to quickly check if a package, Flask, worked with the Python installed on my machine. As I ran the command to install Flask, it alerted me that the package was already installed as I had Anaconda on my machine.
Understanding self in PythonOnce you start using Python, there is no escaping from this word “self”. It is seen in method definitions and in variable initialization. But getting the idea behind it seems somewhat troublesome.
Understanding the asterisk(*) of PythonI’m not a native speaker. Please understand. Python has plentiful types of operations compared to other languages.
How to Web Scrape with Python in 4 MinutesWeb scraping is a technique to automatically access and extract large amounts of information from a website, which can save a huge amount of time and effort. In this article, we will go through an easy example of how to automate downloading hundreds of files from the New York MTA.
Python List Comprehensions VS Generator ExpressionsThe article is written by Mariia Yakimova (MARIIA YAKIMOVA) — an backend engineer at Django Stars. This python list comprehensions is originally posted on Django Stars. Specially shared with freeCodeCamp community.
Why you should use pyenv + Pipenv for your Python projectsThis is an opinionated way of developing with Python locally. You’ve probably discovered that it’s a pain in the ass to manage different projects with dependencies targeting different Python versions on your local machine.
Writing your own programming language and compiler with PythonAfter studying compilers and programming languages, I felt like internet tutorials and guides are way too complex for beginners or are missing some important parts about these topics.
What’s in a (Python’s) __name__?You’ve most likely seen the __name__ variable when you’ve gone through Python code. Below you see an example code snippet of how it may look: In this article, I want to show you how you can make use of this variable to create modules in Python.
Another Twitter sentiment analysis with PythonIt has been a while since my last post. During my absence in Medium, a lot happened in my life. I finally gathered my courage to quit my job, and joined Data Science Immersive course in General Assembly London. It was a big decision in my life, but I don’t regret it.
A tour of the top 5 sorting algorithms with Python codeI recently started a book-focused educational newsletter. Book Dives is a bi-weekly newsletter where for each new issue we dive into a non-fiction book. You’ll learn about the book’s core lessons and how to apply them in real life. You can subscribe for it here.
Dismissing Python Garbage Collection at InstagramBy dismissing the Python garbage collection (GC) mechanism, which reclaims memory by collecting and freeing unused data, Instagram can run 10% more efficiently. Yes, you heard it right! By disabling GC, we can reduce the memory footprint and improve the CPU LLC cache hit ratio.
HowGenerators have been an important part of Python ever since they were introduced with PEP 255. Generator functions allow you to declare a function that behaves like an iterator.
5 Advanced Features of Python and How to Use ThemI recently started a book-focused educational newsletter. Book Dives is a bi-weekly newsletter where for each new issue we dive into a non-fiction book. You’ll learn about the book’s core lessons and how to apply them in real life. You can subscribe for it here. Python is a beautiful language.
Build Simple Restful Api With Python and Flask Part 1I’m going to divide this series into 3 or 4 articles. At the end of the series you would understand how easy to build restful API with flask. In this article we’ll setting our environment and create endpoint that will show “Hello World”. Flask is microframework for python.
Building Beautiful Command Line Interfaces with PythonBefore we dive in building the command line application, lets take a quick peek at Command Line. Command Line programs has been with us since the creation of computer programs and are built on commands. A command line program is a program that operates from the command line or from a shell.
10 common security gotchas in Python and how to avoid themWriting secure code is hard. When you learn a language, a module or a framework, you learn how it supposed to be used. When thinking about security, you need to think about how it can be misused.
10 Python File System Methods You Should KnowYou can write Python programs to interact with the file system to do cool stuff. How to do so isn’t always super clear. This article is a guide for current and aspiring developers and data scientists.
Lambda, Map, and Filter in PythonToday’s piece covers using lambda, map, and filter functions in Python. We’ll be covering the basic syntax of each and walking through some examples to familiarize yourself with using them. Let’s get started! A lambda operator can have any number of arguments but can have only one expression.
Intro to Threads and Processes in PythonCompeting in Kaggle’s Understanding the Amazon from Space competition, I started timing various parts of my code to see if I could speed things up. Speed is critical in Kaggle. Ranking well often requires trying hundreds of architectural and hyper-parameter combinations.
Understanding the underscore( _ ) of PythonI’m not a native speaker. Sorry for my english. Please understand. The underscore (_) is special in Python.
I Wrote a Script to WhatsApp My Parents Every Morning in Just 20 Lines of Python CodeIn our busy work lives, we often forget to WhatsApp our loved ones. Looking at how regular my parents are in messaging me with inspirational quotes and health tips first thing in the morning, it was time to reciprocate.
How I used Python to find interesting people to follow on MediumMedium has a large amount of content, a large number of users, and an almost overwhelming number of posts. When you try to find interesting users to interact with, you’re flooded with visual noise. The process was tedious.
A million requests per second with PythonIs it possible to hit a million requests per second with Python? Probably not until recently. A lot of companies are migrating away from Python and to other programming languages so that they can boost their operation performance and save on server prices, but there’s no need really.
Building a Simple Chatbot from Scratch in Python (using NLTK)I am sure you’ve heard about Duolingo: a popular language-learning app, which gamifies practicing a new language. It is pretty popular due to its innovative styles of teaching a foreign language.
How to scrape websites with Python and BeautifulSoupThere is more information on the Internet than any human can absorb in a lifetime. What you need is not access to that information, but a scalable way to collect, organize, and analyze it. You need web scraping.
An A-Z of useful Python tricksPython is one of the world’s most popular, in-demand programming languages. This is for many reasons: I use Python daily as an integral part of my job as a data scientist. Along the way, I’ve picked up a few useful tricks and tips.
What exactly can you do with Python? Here are Python’s 3 main applications.Well that’s a tricky question to answer, because there are so many applications for Python. Let’s talk about each of them in turn.