On Tue, Oct 25, 2011 at 5:31 AM, Chris Kavanagh wrote:
>
>
> On 10/25/2011 3:50 AM, Dave Angel wrote:
>
>> On 10/25/2011 12:20 AM, Chris Kavanagh wrote:
>>
>>>
>>>
>>> On 10/24/2011 12:06 AM, Marc Tompkins wrote:
>>>
On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh >>>
>>>
>>> My proble
Thank you Ramit. I updated my code since I am running 2.7.1+ on Ubuntu.
Best wishes,
Mina
On 11-10-25 08:02 AM, Prasad, Ramit wrote:
f = open(args.fname, 'r')
lines = f.readlines()
f.close()
If you are using Python 2.6+ you can use a context manager to automatically
close the file. That way
>f = open(args.fname, 'r')
>lines = f.readlines()
>f.close()
If you are using Python 2.6+ you can use a context manager to automatically
close the file. That way you never have to worry about closing any files!
with open(args.fname, 'r') as f:
lines = f.readlines()
Ramit
Ramit Prasad | J
On Tue, Oct 25, 2011 at 9:45 AM, ADRIAN KELLY wrote:
> if i have a dictionary called definitions is there a way of printing the
> keys and not the values that go with them?
>
> thanks so much
>
>
>
> Adrian
>
> ___
> Tutor maillist - Tutor@python.org
>>> definitions =
{'name':'dipo','food':'spaghetti','age':30,'location':'lagos'}
>>> definitions.keys()
['food', 'age', 'name', 'location']
>>> definitions.values()
['spaghetti', 30, 'dipo', 'lagos']
>>>
You can do this to get what you want.
Hope it helps.
On Tue, Oct 25, 2011 at 2:54 PM, wrote
Sure,
mydict = {'a':1, 'b',2}
for key in mydict:
print key
Hope this helps,
Bodsda
Sent from my BlackBerry® wireless device
-Original Message-
From: ADRIAN KELLY
Sender: tutor-bounces+bodsda=googlemail@python.org
Date: Tue, 25 Oct 2011 13:45:50
To:
Subject: [Tutor] printing a
if i have a dictionary called definitions is there a way of printing the keys
and not the values that go with them?
thanks so much
Adrian___
Tutor maillist - Tutor@python.org
To unsubscribe or change
On 10/25/2011 3:50 AM, Dave Angel wrote:
On 10/25/2011 12:20 AM, Chris Kavanagh wrote:
On 10/24/2011 12:06 AM, Marc Tompkins wrote:
On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh
My problem was, I wasn't seeing {member} as referring to the class
objects {t} and {s}. Since it was, we now
On 10/25/2011 7:34 AM, Dave Angel wrote:
(Once again, please don't top-post. It makes your responses out of
order)
On 10/25/2011 04:24 AM, apometron wrote:
I did it very much times, Anssi.
Beyond of run it on Python 2.7 latest build, what do you suggest?
Do install Python 3.2 along the Pyth
(Once again, please don't top-post. It makes your responses out of order)
On 10/25/2011 04:24 AM, apometron wrote:
I did it very much times, Anssi.
Beyond of run it on Python 2.7 latest build, what do you suggest?
Do install Python 3.2 along the Python 2.7 installation could give me
any prob
I did it very much times, Anssi.
Beyond of run it on Python 2.7 latest build, what do you suggest?
Do install Python 3.2 along the Python 2.7 installation could give me
any problems?
cheers,
Apometron
http://about.me/apometron
On 10/25/2011 6:11 AM, Anssi Saari wrote:
apometron writes:
N
On Tue, Oct 25, 2011 at 12:56:56AM +0100, Alan Gauld wrote:
> On 24/10/11 20:52, Johan Martinez wrote:
> >Finally I figured it out ( __length__() ) thanks to ipython shell env.
>
> len(x)
>
> gets converted to x.__length__() by Python.
That's actually __len__ not __length__.
>>> [].__length__
On Mon, Oct 24, 2011 at 07:02:28PM -0400, Christopher King wrote:
> Dear Tutors,
> I am trying to make an object, which will appear exactly like an object
> of my choice. It will should be impossible to tell it is not the object.
Can't be done in Python. The only way to make something absolute
On 10/25/2011 12:20 AM, Chris Kavanagh wrote:
On 10/24/2011 12:06 AM, Marc Tompkins wrote:
On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh
My problem was, I wasn't seeing {member} as referring to the class
objects {t} and {s}. Since it was, we now can use member just like any
class object
14 matches
Mail list logo