Page 1 of 1

How do I avoid quotes in the result of a print command?

Posted: Mon Jan 19, 2015 1:10 pm
by Mastiff
If I only print variables, I see the values and nothing else. But then I try this one:

Code: Select all

print ('Rom:', Rom, 'Tidspunkt: ', eg.globals.Tid[Rom])
Both the variables and the text shows in single quotes. Using double quotes in the code doesn't help either. Is there a way to avoid this? It looks so silly like this:

Code: Select all

 ('Rom:', 'Ute', 'Tidspunkt: ', 'Kl. 14:09, den 19.01.')
Note that even the commas are printed. And without commas the code fails. This is what I want to see:

Code: Select all

 (Rom: Ute, Tidspunkt: Kl. 14:09, den 19.01.)
Edit: I can of course use a few lines to put it together first, but I'm just wondering if there's a slightly different syntax that lets me only use the one, short line.

Re: How do I avoid quotes in the result of a print command?

Posted: Mon Jan 19, 2015 1:31 pm
by Mastiff
Found it, dropping the paranthesis almost made it happen, but not quite:

Code: Select all

print 'Rom:', Rom,'. Tidspunkt: ',eg.globals.Tid[Rom]

Code: Select all

Rom: Kjolerom . Tidspunkt:  Kl. 14:30, den 19.01.
Note the extra space between the Kjolerom (which is cooling room, but without the Norwegian special character ├© which EG doesn't handle very well, so in reality it says "women's dress room" :lol: ) and the period.

Re: How do I avoid quotes in the result of a print command?

Posted: Mon Jan 19, 2015 6:29 pm
by jonib
Try this:

Code: Select all

print "Rom: %s. Tidspunkt: %s"%(Rom,eg.globals.Tid[Rom])
Here is described a newer way of doing the same thing.

jonib

Re: How do I avoid quotes in the result of a print command?

Posted: Mon Jan 19, 2015 7:46 pm
by Mastiff
Thanks, jonib! Works just as I needed it to. If I need something more fancy I'll read more about that input and output chapters, so thanks for the tip!