Python – Page 11 – POFTUT

Category: Python


Python Date Time Functions With Examples

Date time is important part of the application development. Date is used in different format to show, save, or compare events and process. Date and time have different presentation formats which may be change according to countries and localization settings. In this tutorial we will look different usage examples of datetime operations. Import Datetime Library Python datetime functions are provided by the library named datetime and in order to use date...

How To Get Length and Size Of The List In Python? 2

How To Get Length and Size Of The List In Python?

Python is a very expressive language which provides different structures to easy developers work. The list is one of the most popular data structure provided by the python. In a regular workflow, we add and remove elements into and from the list. But in this floating situations, we need to get the length of the list. How can we get the length or size of the list? In this tutorial,...


Random Number Generator In Python

Python is practical language which provides different functions in practical way. Random number are generally used in security related issues but there are other areas too. In this post we will look different random number generation examples about python. Generate Random Number Between 0 and 1 Python provides a library named random by default. This library is used to provide different type of random functions according to given parameters. We will...


Dictionary In Python Tutorial With Examples

Dictionaries is complex data structures those hold information about different type and related information. Dictionaries also called associative memories or associative arrays in different languages. Dictionaries generally format in key and value pair. Keys are used to label and  search and find values. Create Dictionary As we say before we will provide key and value pair. In this example we will create a phone book. The name of the phonebook is pb and have some...


Different Ways To Use Python Print Function

Python is very expressive language which provides a lot of different output types and extensions. Printf is one of the most used function to print output. In this tutorial we will look different usage types of printf Print String Value This is the simplest usage form of the printf function. We will create a variable named a which holds string “Hi Poftut” . We will print this string by providing in to print function.



Python Date Time Operations Tutorial with Examples

Python datetime library provides a lot of different functionalities to operate with date and time values. Python datetime library can be found later versions from 2.3 . There is datetime library related libraries liketime and calender if you are interested specific issue. Time Time values are represented with time class. Time class gives the ability to hold values like hour, minute, second, microsecond. Time values also holds time zone information....


How To Convert Python String To Int?

Python have different variable types. Integer and string types are most used types. And conversation between them is required most of time. In this post we will look howto convert string to int? String is character array like text data. Following examples are all string

All of the above definitions are string but they hold different or numeric characters. Integer is base type for python. Integer is actually an...


Python For Loop Tutorial with Examples

Python programming language provides loops with for statement. It is similar to the most of the main stream programming languages like C, C++, Java or C# . We will look to the for loop Python examples. for loop mainly used to iterate over specified list or array. For Loop Python Syntax Syntax for python for loop is like below.

Simple and Basic For Loop Here is a simple for loop...


Python Command Line Arguments with sys.argv

Python scripts can be run different ways. Python interpreter can be used to file python scripts but it is not so practical. Also scripts are not saved. After interpreter is closed or written code will be lost. Most popular usage to write and run python scripts is creating python script file and running it. Passing parameters or options to the script is very useful. There is two popular way to...


How To Sort Python Dictionary By Value?

We have a dictionary which is read from a file. One field is string other field is number. String fields are unique and used as keys. Sorting by keys is easy but how can we sort them by values Our Dictionary We have the following dictionary which is consist of string and numbers.

By the way we are using python interpreter to make things more interactive and easy Sort...

Enjoy this blog? Please spread the word :)