if param[0:4]<>'ini=':
print ' %s ini='%sys.argv[0]
sys.exit(1)
inifile=param[4:]

Hi All,

Can u explain wht actually above code work?

Thanks in Advance.

First of all, you should use code tags like such:
[code=python] # Code goes in here

[/code]
Which would've given you the following:

if param[0:4]<>'ini=':
    print ' %s ini='%sys.argv[0]
    sys.exit(1)
inifile=param[4:]

Now, to answer your question:
First we check that the first 4 characters of param are "not equal" to ini= ... <> is the obsoleted form of != So, as long as the first four characters of param are not 'ini=' then we execute the code block within the if statement, which is printing the name of our program ( sys.argv[0] is always the name of the running program), and then we exit with a return of 1...

If the first four characters of param WERE 'ini=', then we would execute the line of code immediately after the if block, which declares the variable inifile to be equal to the remainder of param.. here's an example of that slicing:

>>> param = 'ini=myinifile.txt'
>>> param[0:4]
'ini='
>>> param[:4]
'ini='
>>> param[4:]
'myinifile.txt'
>>>
commented: very nice +11