Python import os # List all subdirectories using scandir() basepath = 'my_directory/' with os.scandir(basepath) as entries: for entry in entries: if entry.is_dir(): print(entry.name) As in the file listing example, here you call .is_dir() on each entry returned by os.scandir(...
Impacket is a collection of Python classes for working with network protocols. Impacket is focused on providing low-level programmatic access to the packets and for some protocols (e.g. SMB1-3 and MSRPC) the protocol implementation itself. Packets can be constructed from scratch, as well as pa...
A form’s fields are themselves classes; they manage form data and perform validation when a form is submitted. ADateFieldand aFileFieldhandle very different kinds of data and have to do different things with it. A form field is represented to a user in the browser as an HTML “widget” ...
The arcgis.geometry.Geometry class is a base class from which specific geometry classes inherit. Users generally do not instantiate the base class, but work directly with one or more child classes such as Point, Polyline, Polygon etc. The base class provides geometry operations such as clip(),...
Impacket is a collection of Python classes for working with network protocols. Impacket is focused on providing low-level programmatic access to the packets and for some protocols (e.g. SMB1-3 and MSRPC) the protocol implementation itself. Packets can be constructed from scratch, as well as pa...
Modules and metaclasses are important features of Python. When working on large projects, having a good understanding of modules and metaprogramming will help you write cleaner code. Metaclasses in Python are a kind of hidden feature that you don't need to care about until you have a specific...
Values can be appended to a list by calling append method on list. A method is just like a function, but it is associated with an object and can access that object when it is called. We will learn more about methods when we study classes....
Calling a stored procedure might result in having to deal with multiple result sets as part of a single execution. As a result for the query execution an SqlResult object is returned, which encapsulates the first result set. After processing the result set you can call nextResult() to move ...
Thus, if you fire up the Python REPL and simply type “dir” into the prompt, Python will respond with all of the global functions and classes that are currently loaded. This is a ridiculously powerful tool that’s great to use when exploring new libraries. This reflective vision of th...
Classes are syntactic sugar over functions and functions are also referred to as "callable" objects. So it is possible to treat a function like an object and give them key / value properties like objects. Thestatickeyword gives us the ability to assign a key / value property to a class it...