Python is an object-oriented, strictly, dynamically typed, lexically scoped programming language 
Its object model is quite flexible (single-dispatch, metaclasses, everything is 
                an object), and somewhat similar to that of Smalltalk. Python has some functional programming features: first-class functions, map(), reduce(), list 
                comprehensions, and lexical closures. Python is a very "free-form" language with very few ways of invariant construction.
Python is expected to run slower than Java, but they also take much less time to develop. Python code is typically 3-5 times shorter than equivalent Java code. This difference can be attributed to Python's built-in high-level data types and its dynamic typing.
                
                            
  | 
                    
Almost everything said for Java also applies for C++, just more so: where Python code is typically 3-5 times shorter than equivalent Java code, it is often 5-10 times shorter than equivalent C++ code! Anecdotal evidence suggests that one Python programmer can finish in two months what two C++ programmers can't complete in a year. Python shines as a glue language, used to combine components written in C++.
# import the built-in modules 
import MDM 
 
# Initialize 
res = MDM.send('AT+CMGF=1\r', 0) 
res = MDM.receive(5) 
res = MDM.send('AT+CNMI=2,1\r', 0) 
                    res = MDM.receive(5) 
MDM.send('AT+CMGD=?\r', 0) 
MemSMS = MDM.receive(20) 
startSearch = 0 
StartSearchIndex = MemSMS.find('(')+1 
LastSearchIndex = MemSMS.find(')') 
                    nextComma = MemSMS.find(',',StartSearchIndex,LastSearchIndex) 
#search the next sms 
if ( nextComma != -1): 
    while ( nextComma < LastSearchIndex ): 
                            SMSIndex = MemSMS[StartSearchIndex : nextComma] 
        print SMSIndex 
                            MDM.send('AT+CMGD=', 0) 
        MDM.send(SMSIndex,0) 
        MDM.send('\r',0) 
                            res = MDM.receive(20) 
        print res 
        StartSearchIndex = nextComma + 1 
                            nextComma = MemSMS.find(',',StartSearchIndex,LastSearchIndex) 
#delete the last sms 
SMSIndex = MemSMS[StartSearchIndex : LastSearchIndex] 
                    if (SMSIndex != ''): 
    MDM.send('AT+CMGD=', 0) 
    MDM.send(SMSIndex,0) 
    MDM.send('\r',0) 
    res = MDM.receive(20)  
                

