-
-
Save IndhumathyChelliah/ce6dffa8a0ca87bc85d575b7a2a355ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1="Hello\nworld!\n123" | |
print (s1.splitlines())#Output:['Hello', 'world!', '123'] | |
print (s1.splitlines(keepends=True))#Output:['Hello\n', 'world!\n', '123'] | |
print (s1.splitlines(True))#Output:['Hello\n', 'world!\n', '123'] | |
s2="Hello\t\n123$" | |
print (s2.splitlines())#Output:['Hello\t', '123$'] | |
print (s2.splitlines(keepends=True))#Output:['Hello\t\n', '123$'] | |
s3="Hello\n\r123" | |
print (s3.splitlines())#Output:['Hello', '', '123'] | |
print (s3.splitlines(keepends=True))#Output:['Hello\n', '\r', '123'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment