What are the important built-in data types in Python ?

These are the important built-in data types in Python

1) None Type:
None Type is for the null value in python

2) Numeric Types:

Numeric Types are handled by int , float, complex and bool

  • int : Init type store integer values,it include binary . octa ,hex numbers
  • float: float type store float numbers
  • complex : complex type store complex numbers
  • bool: bool store Boolean numbers

3) Sequence Types:Their are three Sequence Types lists, tuples, and range

  • Lists: Sequence Types used to store collection of item, Lists is Mutable
  • tuples: Sequence Types used to store collection of item, Lists is Immutable
  • range : Sequence Types used to generated sequence of numbers during execution

4) Mapping Types: Stores comma-separated list of key: value pairs

5) Set Types: set types are – set and frozenset

6) Modules: built-in type supported by the Python Interpreter

7) Callable Types: Callable types are the types to which function call can be applied

How to check whether a file exists or not without exceptions in python ?

It is easy to check whether a file exists or not without exceptions in python ,python has a familiar os.path module using this module you can run isfile ,if it return True means a file exists or if it is False means file not exists

Code to check whether a file exists or not without exceptions in python


import os.path
os.path.isfile(FILE_PATH)


e.g 

>>> os.path.isfile("/home/index.html")
True
>>> os.path.isfile("/home/index_new.html")
False