[Tutor] Help me in this programme

2011-10-06 Thread Praveen Singh
this is one of the problem based on list which i found at pyschool. CountWords("google") [('e',1),('g',2),('l',1),('o',2)] by the level of this question you can easily understand i am new in python.the problem i am facing is how to make set of word and count(e,1) and add this to list?? __

Re: [Tutor] declaring a blank interger

2011-10-06 Thread Hugo Arts
On Thu, Oct 6, 2011 at 7:09 AM, Mike Nickey wrote: > Hey all, > I'm sorry for such a silly question but I want to declare a blank integer > for x.  What I have is a base for a program that I'm working on for fun. > Yes, for fun. 1) no question is silly 2) Programming is fun, many people have it a

Re: [Tutor] String switch

2011-10-06 Thread Alan Gauld
On 05/10/11 22:51, Christopher King wrote: There is a program that will open another program, write code at the top of the program. The code at the top will cause the program to print all strings afterwards in swap case. If I understand this correctly you have mainprog.py and subprog.py. And y

Re: [Tutor] Help me in this programme

2011-10-06 Thread Alan Gauld
On 06/10/11 08:15, Praveen Singh wrote: CountWords("google") [('e',1),('g',2),('l',1),('o',2)] by the level of this question you can easily understand i am new in python.the problem i am facing is how to make set of word and count(e,1) and add this to list?? Some clues: a for loop will itera

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread Alan Gauld
On 06/10/11 04:54, lina wrote: If you use IDLE, the standard IDE that comes with Python, you should find that hitting tab (or pausing briefly) in a file editor will bring up a pick list of options. Just tried the idle-python2.6, Q1: Is it bound with certain python version, such as

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread lina
On Thu, Oct 6, 2011 at 5:18 PM, Alan Gauld wrote: > On 06/10/11 04:54, lina wrote: > > If you use IDLE, the standard IDE that comes with Python, you should >>find that hitting tab (or pausing briefly) in a file editor will >>bring up a pick list of options. >> >> Just tried the idle-p

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread lina
On Thu, Oct 6, 2011 at 1:39 PM, Andreas Perstinger < andreas.perstin...@gmx.net> wrote: > On 2011-10-06 05:46, lina wrote: > >> On Thu, Oct 6, 2011 at 4:33 AM, Prasad, >> Ramit >> >wrote: >> >>> Dictionaries {} are containers for key/value based pairs like { key : >>> >>> value, another_key : v

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread Prasad, Ramit
>I attached the two files. Although I will help you, I will not do the work for you. If you are still having errors, please include your script, python version, and the problem (if you are getting an error include the full error). Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currenci

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread lina
On Thu, Oct 6, 2011 at 10:48 PM, Prasad, Ramit wrote: > >I attached the two files. > > Although I will help you, I will not do the work for you. If you are still > having errors, please include your script, python version, and the problem > (if you are getting an error include the full error). >

Re: [Tutor] String switch

2011-10-06 Thread bob gailer
On 10/5/2011 5:51 PM, Christopher King wrote: There is a program that will open another program, write code at the top of the program. The code at the top will cause the program to print all strings afterwards in swap case. What you've told us so far may make total sense to you, but it is not

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread lina
On Thu, Oct 6, 2011 at 4:33 AM, Prasad, Ramit wrote: > >>yes, you're iterating over the keys of a dictionary. Since it only has > the key "E", that's what you get. Try printing dir(results) to see what > methods might return something other than the key. Make the language work > for you. > > >S

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread Andreas Perstinger
On 2011-10-06 16:11, lina wrote: I still don't know how to (standard) convert the list values to a string. def writeonefiledata(outname,results): outfile = open(outname,"w") for key, value in results.items(): print(value) outfile.write(str(results[key])) Is it a wrong

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread Prasad, Ramit
>attached the clumsy script just to prove what I said is true. and at present I >want to "push" myself on the way of >using python. so I can actually learn >something. I think you were close to the solution. It seemed like all you needed to do was write the output to file correctly (which you

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread lina
> > > As for splitting into functions, consider: > > #these two are capitalized because they're intended to be constant > TOKENS = "BE" > LINESTOSKIP = 43 > INFILEEXT = ".xpm" > OUTFILEEXT = ".txt" > > def dofiles(topdirectory): >for filename in os.listdr(topdirectory): >processfile(f

[Tutor] basic problem

2011-10-06 Thread ADRIAN KELLY
Hi all, can someone spell out to me in (simply if possible) what this programme is doing. i understand the concept of the "for" loop and what its doing with the message the user enters. i just cant understand the VOWELS and how it keeps adding 1 letter to the message. thanks for looking

Re: [Tutor] basic problem

2011-10-06 Thread Mac Ryan
On Thu, 6 Oct 2011 22:11:37 + ADRIAN KELLY wrote: > can someone spell out to me in (simply if possible) what this > programme is doing. i understand the concept of the "for" loop and > what its doing with the message the user enters. i just cant > understand the VOWELS and how it keeps add

Re: [Tutor] basic problem

2011-10-06 Thread Alan Gauld
On 06/10/11 23:11, ADRIAN KELLY wrote: can someone spell out to me in (simply if possible) what this programme is doing. Mac has done that pretty well. However, let me add a couple of comments: # this programme will adding something to everything the user #types by using a for loop This c

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread Dave Angel
On 10/06/2011 12:21 PM, lina wrote: As for splitting into functions, consider: #these two are capitalized because they're intended to be constant TOKENS = "BE" LINESTOSKIP = 43 INFILEEXT = ".xpm" OUTFILEEXT = ".txt" def dofiles(topdirectory): for filename in os.listdr(topdirectory):

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-06 Thread Steven D'Aprano
lina wrote: May I ask a further question: a {'B': [4, 5, 6], 'E': {1, 2, 3}} Why is a['B'] a list and a['E'] a set? How can I get the value of set(a['E'])+set(a['B']) I mean, get a new dict 'B+E':[5,7,9] You are confusing different things into one question, as if I had asked: "How

[Tutor] force imports from site-packages?

2011-10-06 Thread Alex Hall
Hi all, I have managed to get a couple of packages in site-packages which share names with some folders in the same directory as a program, or at least a subdir somewhere below has the same name. Is there a way to force my script to look in lib/site-packages before the script's folder? I can't rena

Re: [Tutor] force imports from site-packages?

2011-10-06 Thread Steven D'Aprano
Alex Hall wrote: Hi all, I have managed to get a couple of packages in site-packages which share names with some folders in the same directory as a program, or at least a subdir somewhere below has the same name. Is there a way to force my script to look in lib/site-packages before the script's f

Re: [Tutor] force imports from site-packages?

2011-10-06 Thread Alex Hall
Thanks, it is now working properly. It turned out to be something in the __all__ list that didn'tmake much sense, but now that I know what to use it is working. On 10/6/11, Steven D'Aprano wrote: > Alex Hall wrote: >> Hi all, >> I have managed to get a couple of packages in site-packages which >>