I have a list which I want to sort based on ('a','b','c') first and then
based on (1,2,3)
How do i do these using itemgetter() since the list is nested
A=[('k3', ['b', 3]), ('k2', ['a', 1]), ('k1', ['a', 3]), ('k4', ['c', 2])]
The solution I am looking for is
A_sorted=[ ('k2', ['a', 1]), ('k1
I have the following information
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as values) in
dictionary A.
My expected solution is
A= {'g2': [4], 'g1': [1] }
I wrote the following piece of code which gives me thhe right code, but I am
s
I have the following list
List=[( 'G1', 'CFS', 'FCL', 'R1' ),('G3', 'LOOSEFREIGHT', 'MIXEDLCL', 'R9'),
('G4', 'CFS', 'FCL', 'R10' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R4' ), ('G1',
'CFS', 'FCL', 'R2' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R5') ]
now I want to group this elements of List first by inde
This is a small example i created
from operator import itemgetter
temp={'4':(2,3), '2':(5,8)}
print temp.items()
new_temp=sorted(temp.items(), key=itemgetter(1)
print new_temp
I want to sort the dictionary by the value in the first element of the tuple
((2,3) and (5,8)) and then the second
(year-month-day) =", today
print "Most recent Monday =", monday
On Sat, Mar 5, 2011 at 1:20 PM, ranjan das wrote:
> Sorry David
>
>
>
>
>
>
> Is there any change in the calendar module from Python 2.6 to 2.7.
>
> This example works fine in Python 2.6 b
Sorry David
The correctly indented code with the while loop is
while friday.weekday() != calendar.MONDAY:
MONDAY -= oneday
oneweek = datetime.timedelta(days=7)
nextweek = today + oneweek
nextyear = today.replace(year=today.year+1)
print "Today (year-month-day) =", today
print "Most r
I ran the following code in python 2.6 and then in python 2.7 (using
calendar module) to manipulate dates and times
The following code works fine in Python 2.6 but throws up an error in Python
2.7. Can anyone please say why?
CODE:
import datetime
import calendar
while monday.weekday() != cal
I am facing the following problem
I have a list of the form
INPUT= [ [ ['A1-N','A2-Y','A3-N' ],['B1-Y','B2-N','B3-N' ] ], [.] ]
and I want an output of the form (selecting only those elements which have a
Y associated with them)
OUTPUT=[ ['A2-Y', 'B1-Y'],[] ]
I wrote the followi
I have a list
a=[1,2,3,4,2,5,5,4,6,7,8]
I want to club the repeating elements together and my output should be
something like
a_new=[ [1], [2,2], [3], [4,4] , [5,5,5],[6], [7], [8]]
How do I do this?
I tried the following but it is not giving me the desired result
a=[1,2,3,2,3,4,5,4,5,5,6]
: Write the code completely in python and then from it create a
windows web based application.
Any help is appreciated
Regards,
Ranjan
On Wed, Sep 22, 2010 at 6:38 PM, Wayne Werner wrote:
> On Wed, Sep 22, 2010 at 7:55 AM, ranjan das wrote:
>
>>
>> Please Advise:
>>
>>
Please Advise:
I need to run/execute python module in C#. I am using python 2.6 and visual
studio 10
Ranjan
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hi,
I am new to python, and specially to file handling.
I need to write a program which reads a unique string in a file and
corresponding to the unique string, extracts/reads the n-th line (from the
line in which the unique string occurs).
I say 'n-th line' as I seek a generalized way of doing
Thanks a lot Andre...it is working
On Sat, Sep 12, 2009 at 2:17 PM, Andre Engels wrote:
> On Sat, Sep 12, 2009 at 10:35 AM, ranjan das
> wrote:
> > Hi,
> >
> > I am new to python and i wrote this piece of code which is ofcourse not
> > serving my purpose:
>
Hi,
I am new to python and i wrote this piece of code which is ofcourse not
serving my purpose:
Aim of the code:
To read a file and look for lines which contain the string 'CL'. When found,
print the entry of the next line (positioned directly below the string 'CL')
continue to do this till
14 matches
Mail list logo