Skip to main content

Posts

Showing posts with the label pran sukh

Fallback tag in xslt by pran sukh on python hunter blog.

Fallback: As the name is self explanatory to use something as an alternative if the primary thing does not work well. In xslt the fallback tag works as an alternative tag if any given tag does not work or is not supported by xslt processor.  Note: This fallback will always work in not supported tags, so run time exception will not occur. Data.xml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="XSL.xsl"?> <records> <record> <name> Adam Barr </name> <address> 222 Cherry </address> <phone> 555-797-2355 </phone> </record> <record> <name> Jeff Adell </name> <address> 730 Elm </address> <phone> 555-797-5555 </phone> </record> </records> XSL.xsl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1...

Python Hunter, Slicing, traversing, copy and pit falling of list and tuple in python. By Pran Sukh

Slicing is a technique in python to pick up data from list,tuple and set from desired location. lets make python a bit more beautiful with slicing technique.  Caution :- No animal is hurt during the development of this tutorial :)   it can be done with three arguments.  e.g dataString [ begin : end : step ] argument begin and end are giving lucid  view, these arguments are to instruct the script that from where the slicing will begin and where it will end, but the tricky argument is the last one ( " step ") . it indicates that how many  index or indices  the code have to   hops or skip to pick up the next slice. In the below example the slicing is starting form 6th index or indices and go till 21th  index and after every slice it will skip the 3 index or indices between the begin and end index.  let's take an example :- 1 25 str = "1abcdefghijklmnopqrstuvwxyz" print ( str [ 6 : 21 : 3 ]) list_1 = [ "T...

Python Hunter, Post on Python Tuple.

Tuple is like list but unlike in structure and functionality. first basic difference is can be figured out by the structure. List elements are enclosed with '[]' brackets but tuple elements are enclosed with '()' parentheses. Few properties of tuple:- 1. It is faster than list. 2. Unlike list, tuple is immutable, i.e. tuple's data cannot be changed once created, we should use tuple if we want our data to be safe from accidental change.  As you can see in title picture, you are allowed to see but cannot touch it. 3. We can use tuple as key in dictionaries   whereas this is not the case with list,  we can’t use list as key in dictionary <Link this post (dictionary) will be available on 16 March 2018>.      Examples:-  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 myTuple= tuple ( 'Python' ) # it takes only one parameter print (myTuple) #it will break down each character into separate elements, just l...