On 30/10/14 05:39, Clayton Kirkwood wrote:
So, in this case, the assignment to x is external.
Often I don't see an external assignment, but there
> is an item in the first position within the comprehension.
I've been reviewing this thread and there might be a concept
that you are missing. Seve
On Wed, Oct 29, 2014 at 10:39:53PM -0700, Clayton Kirkwood wrote:
> When you have
> [item for item in [list] if item[0] == key], after the iteration
> completes does item equal the matched entities or does it have the
> original item?
Why don't you try it for yourself and find out? At the inte
On Thu Oct 30 2014 at 7:58:32 AM Lukas Nemec wrote:
> Hello,
>
> take a look at argparse library.
>
Hi Robert,
As Lukas mentions, it sounds like you're looking for a "flag parsing"
library. A flag parsing library reads a set of key/value pairs that are
encoded in sys.argv, so they let comman
NO, NO, NO. The OP is using Python 3.4, and has consistently
shown results accordingly. x does NOT exist after the list
comprehension. That was a flaw in python 2.x which has been
fixed.
Sorry about that, all. I still use Python 2.x most of the time, so
defaulted to that. I am glad that
Hello,
take a look at argparse library.
---
import argparse
parser = argparse.ArgumentParser(description="My prgoram")
parser.add_argument('-y', '--y', help="Y value", required=True)
parser.add_argument('-x', '--x', help="X value", required=True)
def main(x=1, y=2):
print x
print
I have a function with optional arguments x, y and I would like to pass y
or z using a named variable through the command line. Inside a python
script main(y=3) would work, but I have trouble passing y=3 as an argument
in command line.
I have tried the following:
import sys
def main(x=1, y=
On 30/10/14 08:32, jarod...@libero.it wrote:
Sorry for my bad presentation of my problem!!
Thats OK, and this explanation is much better, thanks.
A file with a long liste of gene ad the occurence for sample:
geneSamples
FUS SampleA
TP53SampleA
ATF4SampleB
ATF3SampleC
ATF4
jarod...@libero.it wrote:
> Dear All,
> Sorry for my bad presentation of my problem!!
> I have this tipe of input:
> A file with a long liste of gene ad the occurence for sample:
>
> gene Samples
> FUS SampleA
> TP53 SampleA
> ATF4 SampleB
> ATF3 SampleC
> ATF4 SampleD
> FUS SampleE
> RO
Dear All,
Sorry for my bad presentation of my problem!!
I have this tipe of input:
A file with a long liste of gene ad the occurence for sample:
geneSamples
FUS SampleA
TP53SampleA
ATF4SampleB
ATF3SampleC
ATF4SampleD
FUS SampleE
RORASampleE
RORASampleC
WHat I w
"Clayton Kirkwood" Wrote in message:
>
>
>>-Original Message-
>>From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
>>Behalf Of Dave Angel
>>Sent: Wednesday, October 29, 2014 5:30 AM
>>To: tutor@python.org
>>Subject: Re: [Tutor] Would somebody kindly...
>>
>>"Clayton Kirk
"Martin A. Brown" Wrote in message:
>
> Hi there Clayton,
>
>> values = [ ('a', 1), ('b', 2), ('a', 5), ('c', 7)]
>> key = 'a'
>> pair=[] # -- this assignment is unnecessary
>> x=[pair for pair in values if key == pair[0]]
>> print(x)
>>
>> I get [('a', 1), ('a', 5)]
>
> I also get that re
Hi there Clayton,
values = [ ('a', 1), ('b', 2), ('a', 5), ('c', 7)]
key = 'a'
pair=[] # -- this assignment is unnecessary
x=[pair for pair in values if key == pair[0]]
print(x)
I get [('a', 1), ('a', 5)]
I also get that result. Good.
So, what does that first pair do? I see and have
On Wed, Oct 29, 2014 at 10:39 PM, Clayton Kirkwood
wrote:
> When I run:
> values = [ ('a', 1), ('b', 2), ('a', 5), ('c', 7)]
> key = 'a'
> pair=[]
>
You just created an empty list and called it "pair".
> [pair for pair in values if key == pair[0]]
>
Two things to bear in mind here:
- The stepper
13 matches
Mail list logo