0

There is two data and printing the length of them. Code:

print(len(author),'\n',len(authorUnique))

and output:

5439 
 4443

I would like to get:

5439 
4443

What can I do to get what I want?

SunnyP
  • 3
  • 2
  • Does this answer your question? [How to print without a newline or space](https://stackoverflow.com/questions/493386/how-to-print-without-a-newline-or-space) – nathan liang Apr 06 '22 at 22:12
  • Sorry, to me it looks like your expected and desired outputs are the same, could you elaborate? – Anonymous Apr 06 '22 at 22:17
  • The difference between them is a space at the beginning of second line. – SunnyP Apr 10 '22 at 17:35

1 Answers1

2

Don't print them at once! It's much simpler to split this up into two separate print statements, which also solves your problem:

print(len(author))
print(len(authorUnique))

If you do only want to use one print statement, however, you need to specify the right separator token, like this:

print(len(author), len(authorUnique), sep='\n')
q9i
  • 205
  • 2
  • 11
  • Thanks for both suggestions. And I wanted to know more about print(), so I wanted to do in one print statement. It works! – SunnyP Apr 10 '22 at 17:30