1.

Write the output of the following python code #!/usr/bin/pythonstr = “Line1-a b c d e f\nLine2- a bc\n\nLine4- a b c d”;print str.splitlines( ); print str.splitlines(O); print str.splitlines(3); print str.splitlines(4); print str.splitlines(5);

Answer»

Output

[‘Linel-a b c d e f’, ‘Line2- a b c’, “, ‘Line4- abed’] 

[‘Linel-a b c d e f’, ‘Line2- a b c’, “, ‘Line4- abed’] 

[‘Linel-a b c d e f\ri, ‘Line2- a b c\ri, ‘\n’, ‘Line4- a b c d’] 

[‘Linel-a b c d e f\n’, ‘Line2- a b c\ri, ‘\ri, ‘Line4- a b c d’] 

[‘Linel-a b c d e f\ri, ‘Line2- a b c\ri, ‘\n’, ‘Line4- a bed’]



Discussion

No Comment Found