Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > Python

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-21-2012, 08:22 AM   PM User | #1
Frump
New Coder

 
Join Date: Sep 2010
Posts: 45
Thanks: 8
Thanked 0 Times in 0 Posts
Frump is an unknown quantity at this point
Python lists

Have been trying to follow a python tutorial in the Full Circle magazine and consistently fail?

I typed the following into my text editor "gedit"

Code:
#! /usr/bin/env python

DaysInMonth =
[31,28,31,30,31,30,31,31,30,31,30,31]

print DaysInMonth[6] (for July)
I saved the above as daysinmonth.py in my python_examples directory. I then opened a terminal and navigated to the python_examples directory and typed;

Code:
chmod +x daysinmonth.py
Finally, still in the terminal i typed python ~/python_examples/daysinmonth.py and the output was:

Code:
frump@ubuntu-linux-uk:~$ python ~/python_examples/daysinmonth.py
  File "/home/frump/python_examples/daysinmonth.py", line 3
    DaysInMonth =
                ^
SyntaxError: invalid syntax
frump@ubuntu-linux-uk:~$
Would someone please tell me what i am doing wrong.
Frump is offline   Reply With Quote
Old 07-21-2012, 02:55 PM   PM User | #2
Frump
New Coder

 
Join Date: Sep 2010
Posts: 45
Thanks: 8
Thanked 0 Times in 0 Posts
Frump is an unknown quantity at this point
Resolved

Finally managed to get daysinmonth.py to work by removing (for July) hooray!
Frump is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:54 PM.


Advertisement
Log in to turn off these ads.