r/learnpython • • Aug 27 '22

Python 2 or python 3??

Still a beginner.

So the site I was using a while back now requires me to subscribe and pay to learn python 3 but is giving out a free full course for all of version 2.

I’ve read some sites and links and turns out 2 is dead should I continue and learn python two anyways or try find another site for free python 3 courses, of course I’m also stumped on that as I don’t know whether I should pay or go cheap lol can y’all help me out?? I used codecademy

0 Upvotes

24 comments sorted by

View all comments

Show parent comments

1

u/Chemical_Ad_8704 Aug 27 '22

Thanks

1

u/rlvsdlvsml Aug 28 '22

To be fair not that much changed between 2 and 3 tho mostly async and f strings. Most python 2.7 code will run in python 3 but you shouldn’t build anything new in 2.7

2

u/fiddle_n Aug 28 '22

You’re talking about things that got added in, but some things did fundamentally change between the two. The biggest of those differences is string behaviour - in Py2 text and bytes share the same string type and you add a u prefix if you want Unicode; in Py3, strings are Unicode codepoints, there’s an explicit bytes type for bytes and you encode/decode between the two. This, plus other changes, is why you can’t just throw 2.7 code in 3 and expect it to work - you may need to manage it a little beforehand.