-2
word = {}
a = input('love: ').split()

for line in open('emotion.txt'):
  love, trust = line.split(',')
  word[love]=trust

for i in a:  

  print(word[i])

Hello, I'm trying to make outcome in line when I print it. but I don't know how to get it printed in one line at last. this code's current outcome is.

I 
love
you

but I wanna make it as

I love you

thank you

  • Not that you actually bothered to mention the programming language you're using, but I'd guess you wanted https://stackoverflow.com/q/493386/3001761. Please do research before asking in the future. – jonrsharpe Nov 18 '17 at 23:48
  • What language is this? Please edit your question to add it as a tag. And please take some time to [read about how to ask good questions](http://stackoverflow.com/help/how-to-ask). – Some programmer dude Nov 18 '17 at 23:48
  • 1
    Possible duplicate of [How to print without newline or space?](https://stackoverflow.com/questions/493386/how-to-print-without-newline-or-space) – ekhumoro Nov 19 '17 at 00:52
  • It's python and what more information you need for me to make good question? – Ivory Julia Nov 20 '17 at 01:28
  • jonrsharpe/ And of course I did research, but range is not a matter. DId you even see my code? – Ivory Julia Nov 20 '17 at 01:33

1 Answers1

0

Solution

Put a comma ',' after print statement. This wll solve your issue

word = {}
a = input('love: ').split()

for line in open('emotion.txt'):
  love, trust = line.split(',')
  word[love]=trust

for i in a:  
  print(word[i]),
H. Sodi
  • 540
  • 2
  • 9