+3 votes
in Class 11 by kratos

Write the output of the following python code #!/usr/bin/python

str = “Line1-a b c d e f\nLine2- a b

c\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);

1 Answer

+5 votes
by kratos
 
Best 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’]

...