Skip to content

Instantly share code, notes, and snippets.

View MishraKhushbu's full-sized avatar

KHUSHBU KUMARI MishraKhushbu

  • Bangalore
View GitHub Profile
http://www.comlab.hut.fi/opetus/238/lecture7_RadioInterfaceProtcols.pdf
@MishraKhushbu
MishraKhushbu / Why_dict_is_unordered.py
Created February 21, 2018 05:32
Python_Dictionary_21-Feb-2018
Since Python dictionary stores key value pairs, it uses hashing operations to store the values.
It is not necessary for the hash values to be in sorted order.
So when you print the dictionary the values are displayed on the basis of hash values and so python’s dictionary is un ordered.
If you want python dictionaries in sorted order, you can use sorted() function.
If want to use ordered dict in python we can use "ordereddict" module in short.
from _ordereddict import ordereddict
kio = ordereddict()
kvio = ordereddict(kvio=True)
# without relax unordered initalisation is not allowed
http://www.techtrained.com/paging-procedure-lte/
@MishraKhushbu
MishraKhushbu / Virtualization.py
Last active April 12, 2018 18:29
Virtualization_April_2018
https://www.youtube.com/watch?v=4ht22ReBjno
https://www.youtube.com/watch?v=TvnZTi_gaNc
https://www.youtube.com/watch?v=lcQfQRDAMpQ
@MishraKhushbu
MishraKhushbu / Python_Modules.py
Last active April 19, 2018 10:58
Python_Modules_19_April_2018
JSON - Python has a JSON module that will help converting the datastructures to JSON strings.
Use the import function to import the JSON module.
import json
student = {"101":{"class":'V', "Name":'Rohit', "Roll_no":7},
"102":{"class":'V', "Name":'David', "Roll_no":8},
"103":{"class":'V', "Name":'Samiya', "Roll_no":12}}
print(json.dumps(student));
Output:
{"103": {"class": "V", "Name": "Samiya", "Roll_no": 12},
"102": {"class": "V", "Name": "David", "Roll_no": 8},
@MishraKhushbu
MishraKhushbu / Print_in_Single_line.py
Last active April 10, 2019 08:17
Learn_Python_The_hard_way
If you are using python 2, then you can add a comma after the print function like this:
for i in range(10):
print i, # <- notice the comma at the end
will output:
0 1 2 3 4 5 6 7 8 9
In python 3, print is now a function and will take an argument, called end like this:
print(i, end = " ")
@MishraKhushbu
MishraKhushbu / JSON2XML.py
Last active August 7, 2019 10:50
JSON_TO_XML
import json
def json2xml(str_json): # function to convert json to xml
global my_str_startswith
global my_str_endswith
global mid_str_list
for items in str_json:
@MishraKhushbu
MishraKhushbu / PYTHON_DICTIONARY.py
Created September 5, 2019 05:49
PYTHON_DICTIONARY
Dictionary Methods
Python has a set of built-in methods that you can use on dictionaries.
url : https://www.w3schools.com/python/python_dictionaries.asp
Method Description
clear() ===>Removes all the elements from the dictionary e
copy() ====>Returns a copy of the dictionary
fromkeys()===>Returns a dictionary with the specified keys and values
get() ====>Returns the value of the specified key
@MishraKhushbu
MishraKhushbu / Data_structure.py
Last active September 5, 2019 06:25
Data Structures/29Jan2018
http://res.cloudinary.com/dyd911kmh/image/upload/c_scale,f_auto,q_auto:best,w_700/v1512740202/Template_2_oxrskq.png
Data structures(list,tuple,strings,dictionary,sets)
===========================================================
Diff between tuple and sets
tuple:Immutable type,can contain dubplicates also defined in() whereas indexed
Sets:Mutable type,cannot contain dubplicates and defined in {}
empty set has to define like
@MishraKhushbu
MishraKhushbu / Threading_Python.py
Last active September 6, 2019 06:46
Threading Module
Multiprocessing Vs Multithreading :
Multiprocessing is when the part of program can be executed by separated processes.
The cost of multiprocessing is really high.
MultiThreading:
The main program is divided into sub threads.
Here to decide the number of thread is a big challenge , taking more number of threads can deduce ur latency since
thread concurrency has limit , after a limit it slows down the process.