Re: Invalid syntax error

2012-03-10 Thread Ian Kelly
On Sat, Mar 10, 2012 at 6:17 AM, Günther Dietrich wrote: > In article > <46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com>, >  sl33k wrote: > >>I'm trying project euler problem 3 and I've hit the wall with this >>error. What could be the problem here? >> >> l=[] > num=6008514

Re: Invalid syntax error

2012-03-10 Thread Günther Dietrich
In article <46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com>, sl33k wrote: >I'm trying project euler problem 3 and I've hit the wall with this >error. What could be the problem here? > > l=[] num=600851475143 i=1 while i<=num: >... if num%i==0: >...

Re: Invalid syntax error

2012-03-10 Thread liuerfire Wang
在 2012年3月10日星期六UTC+8下午8时34分35秒,sl33k写道: > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > > l=[] > >>> num=600851475143 > >>> i=1 > >>> while i<=num: > ... if num%i==0: > ... l.append(i) > ... i+=1 > ... print max(l) >

Re: Invalid syntax error

2012-03-10 Thread Ahsan
Just checked my version. Its showing 2.6.5. >>> sys.version '2.6.5 (r265:79063, Apr 16 2010, 13:09:56) \n[GCC 4.4.3]' -- http://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax error

2012-03-10 Thread Vlastimil Brom
2012/3/10 sl33k : > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > >  l=[] num=600851475143 i=1 while i<=num: > ...     if num%i==0: > ...         l.append(i) > ...     i+=1 > ... print max(l) >  File "", line 5 >    prin

Re: Invalid syntax error

2012-03-10 Thread Andrew Berg
On 3/10/2012 6:34 AM, sl33k wrote: > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > > l=[] num=600851475143 i=1 while i<=num: > ... if num%i==0: > ... l.append(i) > ... i+=1 > ... print max(l) > File "

Re: Invalid syntax error

2012-03-10 Thread Amit Sethi
Its an indentation error -- A-M-I-T S|S -- http://mail.python.org/mailman/listinfo/python-list

Re: Invalid Syntax Error

2010-01-14 Thread Benjamin Kaplan
How about you just isolate the first few lines On Thu, Jan 14, 2010 at 2:43 PM, Ray Holt wrote: > try: >     #open file stream >     file = open(file_name, "w" > except IOError: >     print "There was an error writing to", file_name >     sys.exit() Notice anything now? Something missing perhaps

Re: Invalid Syntax Error

2010-01-14 Thread MRAB
Ray Holt wrote: Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" [snip] Missing ")". -- http://mail.python.org/mailman/listinfo/py

Re: Invalid syntax error

2009-12-20 Thread Todd A. Jacobs
On Sun, Dec 20, 2009 at 08:40:05AM -0500, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c You need to pass either a string literal or a variable. If you're passing a string, like you are trying t

Re: Invalid syntax error

2009-12-20 Thread D'Arcy J.M. Cain
On Sun, 20 Dec 2009 08:40:05 -0500 "Ray Holt" wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is You forgot the quotes around the string. I am not on Windows but I think the following will all work. os.

Re: Invalid syntax error

2009-12-20 Thread Xavier Ho
Putting quotemarks "" around the path would be a good start, I think. Cheers, Xav On Sun, Dec 20, 2009 at 11:40 PM, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is > invalid syntax. Why is