Tag: get
Python : How to Get List of all empty Directories ?
In this article we will discuss how to get list of all empty directories. Python’s os module provides a function to iterate over a directory tree i.e. Advertisements os.walk(path) It iterates of the directory tree at give path and for each directory or sub directory it returns a tuple containing, (<Dir Name> , <List of …
Python : How to Get List of all empty Directories ?Read More
Python : How to get list of files in directory and sub directories
In this article we will discuss different methods to generate a list of all files in directory tree. Creating a list of files in directory and sub directories using os.listdir() Python’s os module provides a function to get the list of files or folder in a directory i.e. Advertisements os.listdir(path=’.’) It returns a list of …
Python : How to get list of files in directory and sub directoriesRead More
C++ : How to find an element in vector and get its index ?
In this article we will different ways to find an element in vector and get its index. Suppose we have a vector of int i.e. Advertisements std::vector<int> vecOfNums = { 12, 45, 54, 33, 2, 7, 8, 22, 43, 19 }; Now we want to find if number 22 exists in vector ? If yes …
C++ : How to find an element in vector and get its index ?Read More
C++ : How to get element by index in vector | at() vs operator []
In this article we will discuss different techniques to get an element from vector by index or position. In vector elements are indexed from 0 to size() – 1. To access any element in vector by index vector provides two member functions i.e. at() operator[] Let’s discuss them in detail, Advertisements Access an element in …
C++ : How to get element by index in vector | at() vs operator []Read More
Python Pandas : How to get column and row names in DataFrame
In this article we discuss how to get a list of column and row names of a DataFrame object in python pandas. First of all, create a DataFrame object of students records i.e. Advertisements # List of tuples students = [ (‘jack’, 34, ‘Sydeny’ , ‘Australia’) , (‘Riti’, 30, ‘Delhi’ , ‘India’ ) , (‘Vikas’, …
Python Pandas : How to get column and row names in DataFrameRead More
Python : Get Last Modification date & time of a file. | os.stat() | os.path.getmtime()
In this article we will discuss different ways to get the last modification date & time of a file and how to convert them into different formats. Get last modification time of a file using os.stat() os.stat(pathOfFile) It returns the status of file in the form of an os.stat_result object. It contains information related to a …
Python : Get Last Modification date & time of a file. | os.stat() | os.path.getmtime()Read More
Python : How to get Last Access & Creation date time of a file
In this article we will discuss different ways to get the last access and creation timestamp of a file and how to convert them into different formats. os.stat() Python’s os module provides a function os.stat() Advertisements os.stat(pathOfFile) It accepts the path of file as argument and returns the status of file in the form of an …
Python : How to get Last Access & Creation date time of a fileRead More
Python : How to get Current date and time or timestamp ?
In this article we will discuss different ways to get the current date & timestamp in python. Get the current date & time using datetime.now() Python provides a module datetime which has a class datetime. It provides a method now(). Advertisements datetime.now(tz=None) It returns a datetime class object containing the current date & time information …
Python : How to get Current date and time or timestamp ?Read More
Python : Get List of all running processes and sort by highest memory usage
In this article we will discuss a cross platform way to get a list of all running processes in system and then sort them by memory usage. Python provides a cross platform library psutil to fetch sunning system details like process and system details. Advertisements How to install psutil python library To install psutil using …
Python : Get List of all running processes and sort by highest memory usageRead More
Python : How to get the list of all files in a zip archive
In this article we will discuss different ways to get detail about all files in a zip archive like file’s name & size etc. Get the name of all files in the ZIP archive using ZipFile.namelist() In Python’s zipfile module, ZipFile class provides a member function to get the names of all files in it …
Python : How to get the list of all files in a zip archiveRead More