On Sunday, February 5, 2017 at 11:27:19 PM UTC, pha...@u.rochester.edu wrote:
> Hi everyone. I'm new to python and have hit a bit of a wall with an
> assignment I'm working on. I created a number of classes and instantiated
> them, now I need to create a list out of them. I am looking for somethi
Hi everyone. I'm new to python and have hit a bit of a wall with an assignment
I'm working on. I created a number of classes and instantiated them, now I need
to create a list out of them. I am looking for something more elegant than
appending each object to the list as I instantiate it. I tried
On 12/12/2013 03:10 AM, brian cleere wrote:
I know the problem is with the for loop but don't know how to fix. Any help
with explanation would be appreciated.
#!/bin/env python
import csv
import sys
if len(sys.argv) < 3:
print('Please specify a filename and column number: {} [csvfile]
[c
On 12/11/2013 01:41 PM, Mark Lawrence wrote:
On 11/12/2013 19:22, Chris Angelico wrote:
There is, https://pypi.python.org/pypi/docopt/0.6.1 :)
+1 for docopt. It makes everything very clear. Just type out your usage
string, and then run docopt(usage_str) on it to get a dict of your args.
When
On 11/12/2013 20:03, Chris Angelico wrote:
On Thu, Dec 12, 2013 at 7:00 AM, Mark Lawrence wrote:
I use the alternative X for a mandatory argument X.
Also common, but how do you specify a keyword, then? Say you have a
command with subcommands:
$0 foo x y
Move the foo to (x,y)
$0 bar x y z
Go
On 2013-12-12 07:03, Chris Angelico wrote:
> Also common, but how do you specify a keyword, then? Say you have a
> command with subcommands:
>
> $0 foo x y
> Move the foo to (x,y)
> $0 bar x y z
> Go to bar X, order a Y, and Z it [eg 'compress', 'gzip', 'drink']
>
> How do you show that x/y/z are
On Thu, Dec 12, 2013 at 7:00 AM, Mark Lawrence wrote:
> I use the alternative X for a mandatory argument X.
Also common, but how do you specify a keyword, then? Say you have a
command with subcommands:
$0 foo x y
Move the foo to (x,y)
$0 bar x y z
Go to bar X, order a Y, and Z it [eg 'compress',
On 11/12/2013 19:46, Chris Angelico wrote:
On Thu, Dec 12, 2013 at 6:41 AM, Mark Lawrence wrote:
Square brackets in a usage description often mean "optional". You may
want to be careful of that. There's no really good solution though.
There is, https://pypi.python.org/pypi/docopt/0.6.1 :)
T
On Thu, Dec 12, 2013 at 6:41 AM, Mark Lawrence wrote:
>> Square brackets in a usage description often mean "optional". You may
>> want to be careful of that. There's no really good solution though.
>
> There is, https://pypi.python.org/pypi/docopt/0.6.1 :)
That appears to use for a mandatory arg
On 11/12/2013 19:22, Chris Angelico wrote:
On Thu, Dec 12, 2013 at 6:10 AM, brian cleere wrote:
I know the problem is with the for loop but don't know how to fix. Any help
with explanation would be appreciated.
Your problem is akin to debugging an empty file :) It's not so much a
matter of f
On 11/12/2013 19:10, brian cleere wrote:
I know the problem is with the for loop but don't know how to fix. Any help
with explanation would be appreciated.
#!/bin/env python
import csv
You never use the csv module.
import sys
if len(sys.argv) < 3:
print('Please specify a filename and
On Thu, Dec 12, 2013 at 6:10 AM, brian cleere wrote:
> I know the problem is with the for loop but don't know how to fix. Any help
> with explanation would be appreciated.
Your problem is akin to debugging an empty file :) It's not so much a
matter of fixing what's not working as of starting at
On 2013-12-11 11:10, brian cleere wrote:
> filename = sys.argv[1]
> column = int(sys.argv[2])
>
> for line in filename() , column ():
> elements = line.strip().split(',')
> values.append(int(elements[col]))
1) you need to open the file
2) you need to make use of the csv module on that fi
I know the problem is with the for loop but don't know how to fix. Any help
with explanation would be appreciated.
#!/bin/env python
import csv
import sys
if len(sys.argv) < 3:
print('Please specify a filename and column number: {} [csvfile]
[column]'.format(sys.argv[0]))
sys.exit(1)
f
14 matches
Mail list logo