[Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread jarod...@libero.it
Dear All clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra"," electra"] clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia", "sally"," Castiel","Sam"] I have a list of names that I would to annotate in function of presence in different clubs: my input files

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Mark Lawrence
On 27/05/2014 09:05, jarod...@libero.it wrote: Dear All clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra"," electra"] clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia", "sally"," Castiel","Sam"] I have a list of names that I would to annotate in function

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Dave Angel
"jarod...@libero.it" Wrote in message: > Dear All > > clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra"," > electra"] > clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia", "sally"," > Castiel","Sam"] > > I have a list of names that I would to annotate in f

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Steven D'Aprano
On Tue, May 27, 2014 at 10:05:30AM +0200, jarod...@libero.it wrote: [...] > with open("file.in") as p: > mit = [] You have lost the indentation, which makes this code incorrect. But the rest of the code is too complicated. > for i in p: >lines =i.strip("\n").split("\t") >if (lines[0] in

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Peter Otten
jarod...@libero.it wrote: > Dear All > > clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra"," > electra"] > clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia", > "sally"," Castiel","Sam"] > > I have a list of names that I would to annotate in function of pr

[Tutor] R: Tutor Digest, Vol 123, Issue 65

2014-05-27 Thread jarod...@libero.it
Thanks so much for the help! and suggestions I not use dictionary because I have some items are repeated inside the list >Messaggio originale >Da: tutor-requ...@python.org >Data: 27/05/2014 12.00 >A: >Ogg: Tutor Digest, Vol 123, Issue 65 > >Send Tutor mailing list submissions to >

[Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread Degreat Yartey
I am studying python on my own (i.e. i am between the beginner and intermediate level) and i haven't met any difficulty until i reached the topic 'Generators and Iterators'. I need an explanation so simple as using the expression 'print ()', in this case 'yield'. Python 2.6 here! Thank you. ___

[Tutor] pipes and redirecting

2014-05-27 Thread Adam Gold
I'm trying to run the following unix command from within Python as opposed to calling an external Bash script (the reason being I'm doing it multiple times within a for loop which is running through a list): "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,sync | pbzip2 > 1.img.bz2" The first thing

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread R. Alan Monroe
> I need an explanation so simple as using the expression 'print ()', in this > case 'yield'. > Python 2.6 here! Ever write any C programs with static variables? Generators can be explained in those terms if you have experience with them. Alan ___ Tut

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread Danny Yoo
On Tue, May 27, 2014 at 12:27 PM, Degreat Yartey wrote: > I am studying python on my own (i.e. i am between the beginner and > intermediate level) and i haven't met any difficulty until i reached the > topic 'Generators and Iterators'. > I need an explanation so simple as using the expression 'pri

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread Marc Tompkins
On Tue, May 27, 2014 at 12:27 PM, Degreat Yartey wrote: > I am studying python on my own (i.e. i am between the beginner and > intermediate level) and i haven't met any difficulty until i reached the > topic 'Generators and Iterators'. > I need an explanation so simple as using the expression 'pri

Re: [Tutor] Move files to a new directory with matching folder names

2014-05-27 Thread questions anon
Thanks all, I got it to work using: import os import shutil destination_prefix="/Data/test/" source_prefix="/Data/test1/" for year in range(2011, 2013): year = str(year) for month in range(1, 13): # convert to a string with leading 0 if needed month = "%02d" % month source = os.path.jo