I want end="" to stop after it has removed all the spaces between integers.
The result I get is this:
106111104110word
but I want to get this:
106111104110
word
Code:
name = 'john'
for char in name:
print(ord(char), end="")
print("word")
CodePudding user response:
Add \n
in your code:
name = 'john'
for char in name:
print(ord(char), end="")
print("\nword")
CodePudding user response:
store your answer in a variable, and then print. Other answers in this thread work too, but this way you can also use the result.
name = 'john'
result = ""
for char in name:
result = str(ord(char))
print(result)
print("word")
CodePudding user response:
You could do this:
name = 'john'
for char in name:
print(ord(char), end="")
print()
print("word")