3 Respostas
+ 4
Hi Rahul,
A similar question was just asked recently today, I dug up a link I seemed to use a few times ages ago which may help you:
http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
If you are just starting out, start with python3!
if you have a particular question related to it post it here and we can help out :)
+ 2
I see you updated your question :)
yes you can import most libraries, however some do not have the same syntax.
I use configparser in some of my code which had to be compatible with many versions so I do a check against the python version with:
if (sys.version_info > (3, 0)):
from configpaser import *
else:
from ConfigParser import *
note the case on the python 3 is all lower case.
also using python 3 you should use unicode strings where possible as newer modules only work with those, however python 2 does work with the same.
another one I recently came across was StringIO
for compatibility i used:
import StringIO #for python2 and
import io as StringIO # for python3
that's just some examples.
+ 1
thanx , link is the guide of differences :)