Python Technologies - Study24x7
Social learning Network

Welcome Back

Get a free Account today !

or
pythontechnologies Cover image
pythontechnologies
Python Technologies
  • Followers
  • Latest Feeds
  • Articles
  • Question
  • Course
  • About
  • Review
Interests
Python Technologies
14 followers study24x7 10 Feb 2019 10:49 PM study24x7 study24x7

File Access Modes in Python:

1. Read Only ('r') : Read mode which is used when the file is only being read.This is also the default mode in which file is opened.
2. Write Only ('w') : Erase and write to a file.
3. Read and Write ('r+') : Open the file for reading and writing, which is used to handle both actions when working with a file.
4. Write and Read ('w+') : Write and read a file, overwriting its contents.
5. Append Only ('a'): Appending mode, which is used to add new lines to the end of a file.
6. Append and Read ('a+') : Open the file for reading and writing. The data being written is in appending mode,which is used to add new lines to the end of a file.

study24x7
Write a comment
14 followers study24x7 03 Feb 2019 10:50 PM study24x7 study24x7

Exception Handling in Python:
The try block lets you test a block of code for errors.
The except block lets you handle the error.
The code in the finally block will be executed regardless of whether an exception occurs.

Basic Syntax :
try:
// Code
except:
// Code
finally:
// Code

study24x7
Write a comment
14 followers study24x7 22 Jan 2019 01:08 AM study24x7 study24x7

The if…elif…else statement is used in Python for decision making.
When you want to justify one condition while the other condition is false, then you use "if statement".
The "else condition" is usually used when one condition goes wrong or fails to meet the requirement.
By using "elif" condition, you are telling the program to print out the third condition or check for 4th,5th possibilities when the other condition goes wrong or incorrect.

Syntax:
if test expression:
Body of if
elif test expression:
Body of elif
else:
Body of else

study24x7
Write a comment
14 followers study24x7 14 Jan 2019 11:23 AM study24x7 study24x7

There are four collection data types in the Python programming language:

a)List is a collection which is ordered and changeable. It is created by placing all the items (elements) inside a square bracket [] separated by commas and allows duplicate members.
b)Tuple is a collection which is ordered and unchangeable and it allows duplicate members. And, one cannot change elements of a tuple once it is defined.
c)A set is an unordered collection of items where every element is unique (no duplicates). Sets are mutable. You can add, remove and delete elements of a set.
d)Dictionary is a collection which is unordered, changeable and indexed and has no duplicate members.While other compound data types have only value as an element, a dictionary has a key: value pair.

study24x7
Write a comment
14 followers study24x7 04 Jan 2019 11:44 AM study24x7 study24x7

Python is a widely used general-purpose, high level programming language. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability and its syntax allows programmers to express concepts in fewer lines of code.It has deep support for more advanced software reuse mechanisms, such as object-oriented programming (OOP).
It's great as a first language because it is concise and easy to read, and it is also a good language to have in any programmer's stack as it can be used for everything from web development to software development and scientific applications.

study24x7
Write a comment
  • Vinayak Harti
  • Hello Folks,
    I want to learn python scripting. for the same want to understand the logic from where we can start writing the script based on requirement. Please help thank you
    Ratings
    5.0
    out of 5
    2 Ratings
    5 study24x7
     
    2.0
    4 study24x7
     
    0.0
    3 study24x7
     
    0.0
    2 study24x7
     
    0.0
    1 study24x7
     
    0.0
    Related Pages

    General Knowledge An..

    1887 followers

    RAU IAS COACHING

    1628 followers

    SSC 2021 Preparation..

    1548 followers

    UPSC Civil Services ..

    1511 followers

    KBC Q And A

    76 followers

    STUDY WITH VIJAY.

    26 followers

    Java Beginner

    8 followers