On Tue, Apr 10, 2012 at 12:16 AM, Dave Angel wrote:
> On 04/10/2012 02:04 AM, Shashank Singh wrote:
> > On Mon, Apr 9, 2012 at 10:49 PM, Nikhil Verma >wrote:
> >
> >> I am trying this but its giving me a generator object.
> >>
> >> In [9]: (k
Real', 81: u'Real', 83: u'Real', 84: u'Real', 91:
u'Real', 93: u'Real'}
>>>
If you just want the keys
>>> [k for k in for_patient_type if for_patient_type[k] == 'Real']
[80, 81, 83, 84, 91, 93, 79]
>>>
>
> I am trying this but its giving me a generator object.
>
> In [9]: (k for k,v in for_patient_type.iteritems() if v == 'Real')
>
Iterating over a dict gives you all the keys, not the key value pairs
--
Regards
Shashank Singh
http://www.flipora.com
http://r <http://www.cse.iitb.ac.in/~shashanksingh>ationalpie.wordpress.com
--
http://mail.python.org/mailman/listinfo/python-list
th of which apparently
>
> Forgot the refs:
>
> [1]https://github.com/facebook/fbconsole;
> http://blog.carduner.net/2011/09/06/easy-facebook-scripting-in-python/
>
> [2]https://github.com/jgorset/facepy
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Regar
one assign to [] by checking
for None inside the function
def f(a=None):
if a is None: a = []
--
Regards
Shashank Singh
http://rationalpie.wordpress.com
--
http://mail.python.org/mailman/listinfo/python-list
his ? What is the best (fastest)
> way to insert sorted in a list ?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Regards
Shashank Singh
http://www.cse.iitb.ac.in/~shashanksingh
--
http://mail.python.org/mailman/listinfo/python-list
10, 20:10:18)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> string = 'This is a sample python programming'
>>> space = 2
>>> def strsplit(stri
> just stopped at 10.
>
> You are probably right in saying that the caller can make sure that the
> parameters are such that such cases don't arise but I would still like to see
> python doing the best possible thing as far as possible.
>
>
--
Regards
Sh
asy in terms of the change in code
required it might break any code depending
on this seemingly incorrect behavior.
[1]. http://docs.python.org/library/itertools.html#itertools.islice
--
Regards
Shashank Singh
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh<http://www.cse.iitb.ac.in/%7Eshashanksingh>
--
http://mail.python.org/mailman/listinfo/python-list
article about this
> subject? I imagine that it has a concise name.
>
> Thanks,
>
> Tobiah
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Regards
Shashank Singh
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh<http://www.cse.iitb.ac.in/%7Eshashanksingh>
--
http://mail.python.org/mailman/listinfo/python-list
ay to append to
> the front of the list directly?
> TIA,
> beno
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 30, 2010 at 10:53 PM, joy99 wrote:
> class Person(object):
>def _init_(self,name,age):
>self.name=name
>self.age=age
>
> constructor has double underscores (both as prefix and suffix) __init__
--
Regards
Shashank Singh
Se
, t3.timeit(number=1000)
The output for one run was:
f1 0.393015034034
f2 0.476230638252
f3 0.376324923978
=> simple for loop performs better than map/imap. Another problem with
map/imap is that the memory cost is dependent on the length of the list
(because of the intermediate mapped list store
suggestions will be appreciated.
TIA
--
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh
--
http://mail.python.org/mailman/listinfo/python-list
y
do that.
HTH
-S
>
> Thanks
> ~S
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.si...@gmail.com
http://www.cse.iitb.ac.in/~shashanksingh
--
http://mail.python.org/mailman/listinfo/python-list
how do you get a random
> element from a set?
>
> random.choice(list(s))
>
> is the most straightforward way and will work a lot of the time, but
> how would you avoid creating the list? I can't think of a way off
> hand.
>
> How about random.sample(s, 1)[0]? Is it ineff
on 2 except in certain
> circumstances where the value of b has already been determined for
> other purposes. Solution 3 is slower due to the function overhead.
>
> Curious to see what other types of solutions people might have.
>
> Thanks,
> Daniel
> --
> http://mail.pyt
t of python, so unable to figure a way out. Can
> someone help me in this regard either how to solve my downloading
> problem or how to get Brown Corpus from some other link.
> Thanks in advance.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Regards
Sha
n that in each line whatever secondary structure is coming more than
> or equal to two times it should write that as final secondary structure and
> if two seconday structure are coming two-two times in one line itself like:
>
> 4 ALA Helix Sheet Helix Sheet
>
> then it should w
;>>soo([1])
> 2
> >>>soo()
> 1
>
> Why foo() is incremented by 1 always when we are not passing any argument,
> but this is not happening in soo() case, In which scenario we will use
> these type of function.'
>
> Thanks
> Jitendra Kumar
>
>
) in fetched:
> aDict[name] = {}
> return aDict
>
def getChildren(levelDict, level = 0):
> MAXLEVEL = 7
> if level > MAXLEVEL:
> return #possibly the data has a cycle/loop
> for (nm, dt) in levelDict:
>
Are you sure your key values are 2-tuples in level
Hi All!
I have a very simple (and probably stupid) question eluding me.
When exactly is the char-set information needed?
To make my question clear consider reading a file.
While reading a file, all I get is basically an array of bytes.
Now suppose a file has 10 bytes in it (all is data, no metad
21 matches
Mail list logo