+ 13
☆HRITIK GAUTAM☆ , here is sample with a string that contains a new-line sequence: str1 = "hello\n" print(str(str1)) # we do not need to use str() here print(repr(str1)) # output is: # hello # 'hello\n' str2 = "hello\nworld" print(str(str2)) # we do not need to use str() here. output is on 2 lines print(repr(str2)) # output is on 1 line # output is: # hello # world # 'hello\nworld'
14th Mar 2022, 3:41 PM
Lothar
Lothar - avatar