Python Forum
Diff. between Py 2.7 and 3 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Diff. between Py 2.7 and 3 (/thread-13812.html)



Diff. between Py 2.7 and 3 - ebolisa - Nov-01-2018

Hi,

For a while I was going mad trying to find out why the print output from the test code below using Python 2.7 had single quotes added till a ran the sketch with Python 3. Why the difference?

a = "a"
b = "b"
c = "2.5"

a = a.strip('\"')
b = b.replace('"', '').replace("'", '')
c = float(c.strip('\"'))

print (a, b, c)
output with ver. 2.7
Output:
('a', 'b', 2.5)
and with ver 3.5
Output:
a b 2.5



RE: Diff. between Py 2.7 and 3 - wavic - Nov-01-2018

You are giving the print statement a tuple.