Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 24th, 2012, 03:25 AM
superversion970 superversion970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 superversion970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 18 sec
Reputation Power: 0
Facing problem in running program and need a solution

Hello, I am new to python. stared learning python only. At first , I downloaded python 2.4 and there i had run some program successfully. But today I downloaded python 3.3. I tried to run those program in python 3.3 which i run in python 2.4 successfully but those programs are not working in 3.3. i didn't make any changes in program. it shows syntax error every time. I am not understanding whats happening.

Reply With Quote
  #2  
Old December 24th, 2012, 03:51 AM
jadedrakerider jadedrakerider is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 6 jadedrakerider User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 14 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by superversion970
it shows syntax error every time. I am not understanding whats happening.


Python 2 and 3 have different syntax rules. You'll have to read the differences on the website. If you're just learning, stick with Python 2.x

Python 2 code will note run in python 3

Reply With Quote
  #3  
Old December 24th, 2012, 04:22 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,357 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 9 h 10 m 17 sec
Reputation Power: 383
2to3

The most likely problem is print.
In python3 print is a function, not a statement.

print 'my string'
is a python 3 syntax error just as is
math.sin math.pi/3


raw_input no longer exists in python3, although that wouldn't cause syntax error.


Use python's 2to3 tool to convert your program from version 2 to version 3. The program handles most everything. On my system (shell prompt "$ " it is)

$ 2to3-2.7 --help

I've only used it once myself, but then again I started using python3 while it was an early beta release.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #4  
Old December 24th, 2012, 04:42 AM
superversion970 superversion970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 superversion970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 18 sec
Reputation Power: 0
Thank you for the answer

Quote:
Originally Posted by jadedrakerider
If you're just learning, stick with Python 2.x


If I learn python 2.x and after that when I will start learning 3.x ,will I have to learn form the beginning ? or 2.x and 3.x are same without some differences?

Reply With Quote
  #5  
Old December 24th, 2012, 04:45 AM
superversion970 superversion970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 superversion970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 18 sec
Reputation Power: 0
Thank you

Quote:
Originally Posted by b49P23TIvg


Use python's 2to3 tool to convert your program from version 2 to version 3. The program handles most everything.



I am interested in python 3.x . can you please give me some links for python 3.x tutorial?

Reply With Quote
  #6  
Old December 24th, 2012, 06:55 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,357 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 9 h 10 m 17 sec
Reputation Power: 383
Guido handed out a short python3 cheat sheet at one of the python conferences. Mine is long lost, and I don't see it on the web.
Here find a longer one.

Look up python3k, python3000, and the PEPs starting from number 3000.

GVR on python3
http://www.python.org/dev/peps/pep-3000/

Reply With Quote
  #7  
Old December 24th, 2012, 06:58 AM
superversion970 superversion970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 superversion970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 18 sec
Reputation Power: 0

Thank you

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Facing problem in running program and need a solution

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap