0% found this document useful (0 votes)
3 views2 pages

File Handling and Numpy Basics Guide

Uploaded by

bhotosooty
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

File Handling and Numpy Basics Guide

Uploaded by

bhotosooty
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

File Handling:-

------------------

file1= open(r"C:\Users\email\OneDrive\Desktop\[Link]","r+")
print([Link]()) -- tells where the cursur is.
[Link]("Hello \n")
[Link](position) -- moves the cursor to given position
print([Link](1000)) -- reads given number of characters.
print([Link]()) -- reads 1 line of data from file.
print([Link]()) -- the data as a string list of sentances.

[Link]()

Exception Handling :-
---------------------
--> handling the excepion from abnormal termination of program excution.
try:
--- lines of code which may cause exception
except Excception_name as e:
---block of code to execute when exception occured
finally:
--block of code that executed irrespective of exception.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------

Numpy :- numerical python


=============
--> it is a module consist of array data structure and its functions.
Array:-
-->homogeneous
--> indexed / ordered
--> mutable* -size is fixed but replace the values in array
--> it allows duplicates

functions:- function of numpy module


---------------------------------------
[Link](size) -- it create an array with given size and fill the array with zeros.

[Link](size) -- it create an array with given size and fill the array with ones

[Link](start,stop,step,datatype) -- it create an array and fill it with given


range and step(skip) with data type

[Link](st,sp,count,type) -- create an array with items of given [Link] size


depends on given count and there is equal difference between each to items.

[Link](st,st,size)-- give array with given size filled with random number
within given range.

Array attributes:-
-------------------
1.array_name.size --returns the size of array
2.array_name.ndim -- returns numbers of dimention (2d ,3d, 1d)
3.array_name.dtype --returns the data type of items in array.
4.array_name.shape --returns the sahpe of array (if it's a 2d -return no.
rows,[Link])

You might also like