Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Python 3 [New Features for Newbies]


Python 3 is significant upgrade from python 2.
In Python 3 everything is object
Python 3 is future


Python 3
Print Function

In Python 2
Code
print'This is old way'
In Python 3
Code
print('This is new way)

Format Strings

In Pyhton 2
a = 5
Code
print'This is String %d'%a

In Pyhton 3
Code
a = 5
print ('This is new way {}'.format(a))
(.format) is so much powerful we can use dictionay example
like :
Code
d = dict(one = 1 , two = 2)
print('Format using dictionary {one} {two}.format(**d))


Guys you can post new features more and i will try to add more.
Note : I am also newbie :)
python 2 --> raw_input()
python 3 --> input()
Is try: except for python 3 only or is universal to both versions?
python 3 is more difficult then python 2... im frustrated that alot of what i type in is not registering and just pops a syntax error. and im just doing the hello world aspect
(Jan 13, 2015 01:53 PM)SIM-2302716 Wrote:  What are you trying to do exactly? Because Py3 is not harder than Py2.

is better starting to code in python 2 or 3 ?
Isn't print in Python 3 now:

Print('Here')

You only added one ' in your post.
Guys Python 3 is future but google also using older python 2 version but its good to start with python 3 .In starting we see only difference in print function but difference is alot more..In my suggestion try python 3
.format() can be used in python 2 aswell


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by DarkTitanJul 27, 2020 12:33 PM 0 118 Jul 27, 2020 12:33 PM
Last Post: DarkTitan
[Java] by LukeUseTheForceJan 26, 2016 10:22 PM 22 741 Jan 26, 2016 10:22 PM
Last Post: LukeUseTheForce