Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Diff. between Py 2.7 and 3
#1
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
Reply


Messages In This Thread
Diff. between Py 2.7 and 3 - by ebolisa - Nov-01-2018, 06:28 PM
RE: Diff. between Py 2.7 and 3 - by wavic - Nov-01-2018, 06:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to diff pandas rows and modify column value Mekala 1 1,739 Sep-18-2020, 12:38 PM
Last Post: Mekala
  Diff. between Py 2.7 and 3 ebolisa 2 7,967 Dec-15-2018, 11:46 AM
Last Post: ebolisa
  Diff Check - Print from dcmp.diff_files ipuente 0 2,648 Jun-22-2018, 09:44 PM
Last Post: ipuente
  Diff between 1 file to serveral files tcpip 3 3,875 Aug-21-2017, 08:54 AM
Last Post: tcpip

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020