3 Replies - 1639 Views - Last Post: 17 July 2010 - 02:08 PM Rate Topic: -----

#1 BuhRock  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 256
  • Joined: 21-February 10

New to Python

Posted 01 July 2010 - 04:58 PM

I just downloaded Python from python.org. I downloaded the 3.1 version. I was reading an ebook on python. I'm not sure If I am doing something wrong, but I can't even get a print statement right. In the IDLE, can I not type

print "hey"

It says invalid syntax.

Can someone show me some beginner tutorials?
Is This A Good Question/Topic? 0
  • +

Replies To: New to Python

#2 Skaggles  Icon User is offline

  • member icon

Reputation: 255
  • View blog
  • Posts: 641
  • Joined: 01-March 09

Re: New to Python

Posted 01 July 2010 - 05:10 PM

Try placing parentheses around your string: print("Hello!"). I read that newer versions of Python prefer this method. You can look through the tutorials section right here on Dream.In.Code for Python tutorials. One you may find interesting is atik97's An Introduction To Python.

This post has been edited by Skaggles: 01 July 2010 - 05:11 PM

Was This Post Helpful? 0
  • +
  • -

#3 Motoma  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 452
  • View blog
  • Posts: 798
  • Joined: 08-June 10

Re: New to Python

Posted 02 July 2010 - 09:54 AM

To elaborate on @Skaggles' response:

Python 3 deprecated many of the coding styles of Python 2. The two are not intended to be directly compatible. Additionally, many of the standard Python modules have been removed, renamed, or replaced. This will make learning Python 3 from a Python 2 book very difficult.

If you are learning Python from a book, you should ensure you are using the same major version of Python as the book. Python supports a side-by-side install with 2.x and 3.x, so it shouldn't be a problem.

And it is not a big deal either. Python 2 and Python 3 are being developed in parallel. That is to say, there are new versions of both Python 2.7 and Python 3.1 being released. Additionally, a large majority of Python programs are written for Python 2.x, as migrating them to Python 3.x would be a daunting task.

As I mentioned above, it would be my suggestion to uninstall Python 3.1, and install Python 2.7 while you are learning. This will make programming, finding modules, and searching for help on the internet much easier. Once you have a good grasp of Python, then you can address the issues associated with the different syntax of 3.x, migration, and parallel installs.

I hope this clears things up,
Was This Post Helpful? 0
  • +
  • -

#4 Guest_yeerp*


Re: New to Python

Posted 17 July 2010 - 02:08 PM

You have py3k installed but you work with py2k tutorials.
in py3k print is a function so you have to write print("blablabla") to get the thing done...
try diving into python 3 by ummm i dont know but his first name is mark. its a free ebook
Was This Post Helpful? 0

Page 1 of 1