Tag Archives: Python tutorial

Python Directory management

In this article, We are going to learn about files and directory management in python. Different methods available in python os path module. We are going to cover topics like, How to create a folder using python, How to rename a directory using python, Listing all directories and working with them. What is directory/folder management in python: Basically Directory or folder is a container for holding the files and sub-directories. In context of python directory/folder and file management we are going to perform following operations on

Read More

Python File Handling I/O – Reading and Writing files in python

In this article we are going to learn about file handling in python. How to open a file using python, Different python methods to Read and write a content in a file. Close the file once we are done with the editing. Also we are going to see other methods available in python read/write mode. File handling in python: So before getting started with the topic file handling in python. Let’s first try to understand what is a file? Term “file” is very basic concept for

Read More

function arguments in python

Introduction to function arguments in python: In python, Inputs given to the function are known as function arguments or parameters. Depending upon how we have defined the function, There are four basic types of arguments and in this article we are going to learn each the argument type in detail. If you don’t know the terms python function, argument, return statement etc. then I would request you to please go through the earlier article Python Functions. Python user defined function: To start with this article, Let’s

Read More

Functions in python

Introduction to python functions: In this article, We are going to learn what is python function? Different types of python functions. How to write and call python function in a program. So let’s get started with the definition of python function. What is python function? Function in python is a collection of related statements which are used to perform a specific task and return the result or value to the caller of the function. It basically breaks our code into smaller and modular chunks of code and

Read More

Sets in python

Introduction to sets in python: In this tutorial we are going to learn python Set data type. So let’s first start with the definition of python set data type. It is an unordered collection of unique (non duplicates) immutable elements or items. Here an individual data item of set is called as an element or an item of set. set_variable = {1,2,3} In above example numbers 1, 2, 3 are known as the elements or items of set. How to create a Set in python? There

Read More

String slicing and indexing in python

What is slicing and indexing in python? To understand string slicing and indexing let’s first understand what is the definition of string? So basically the String is a sequence of characters which consists of letters, numbers, symbols and white spaces. Now since strings is a sequence. In python we have a provision, using which we can access and work with each and every part of string sequence. In technical words this accessing and working with the strings is known as string indexing and string slicing. String Indexing

Read More

String concatenation and replication in python

Introduction to strings in python: String is a sequence of characters which includes letters, numbers and symbols like punctuation marks etc. In simple words string is the data in text format. Strings data type also contains white spaces in it. Text data is one of the mostly used data type in our day to day life. Let’s see one example of strings, In python “Apple” is a string and sentence “I ate an apple” is also a string, not only that but “123789” is also a

Read More

Identifiers and keywords in Python

What is meant by Identifiers and keywords in python? Both of these terms are related to naming conventions in python programming. In python code individual names given to the entities like variable, class, method etc. are known as identifiers. There are few words which are kept reserved by python language, which can’t be used as an identifiers. These reserved words are known as Keywords. That was the brief definition about identifier and keyword now let’s understand both of these terms thoroghly. Python Identifiers: In python program

Read More

Comments and indentation in python

How to add comments in python code: Comments are basically non-executable lines added in your program. While actual execution of program these commented lines are ignored by interpreter. Every programming language has its own way of inserting non-executable lines in the code. This provision of inserting comments in program is highly used in daily programming work. You can write anything as a comment in your program. Comments in python programming can be used to write a short description about the code. so that next time if

Read More