Re: [Tutor] entering text on web site

2012-06-13 Thread Michiel Overtoom
On Jun 13, 2012, at 14:35, Benjamin Fishbein wrote: > I want to put text in a text box on the webpage, have it entered into the > website, and then get the results. Is there a way to do this with Python? http://wwwsearch.sourceforge.net/mechanize/ is good for this. -- Test your knowledge of f

Re: [Tutor] Can't figure out the syntax error!

2011-10-03 Thread Michiel Overtoom
On Oct 3, 2011, at 18:50, Joel Goldstick wrote: > But you have some other problems. You keep getting a new random number in > your while loop. Maybe that gives an extra challenge? Guess the random number, which will change after each guess! ;-) Greetings, -- "A creative man is motivated

Re: [Tutor] html files to pdf document

2011-06-20 Thread Michiel Overtoom
On Jun 21, 2011, at 00:19, Walter Prins wrote: > For reference, for me the top hit is http://www.xhtml2pdf.com/ which does > indeed look like it might do the job (and is a pure python solution.) I get five SERP pages with tons of Stackoverflow hits, but not one for www.xhtml2pdf.com! I think

Re: [Tutor] html files to pdf document

2011-06-20 Thread Michiel Overtoom
On Jun 20, 2011, at 18:58, Timo wrote: > On 20-06-11 17:34, arun kumar wrote: >> HI, i have a some 100 plus html individual files.I want to convert them to >> a single pdf document programatically. How to convert them in python. Are >> there any functions,modules or libraries for python to ac

Re: [Tutor] Excited about python

2011-06-10 Thread Michiel Overtoom
On Jun 10, 2011, at 15:53, Ashwini Oruganti wrote: > You can also try "Learning Python" I also came from a C/C++ background, but I found the standard tutorial sufficient. http://docs.python.org/tutorial/ Greetings, > On Fri, Jun 10, 2011 at 6:11 PM, Kaustubh Pratap chand > wrote: > Hello

Re: [Tutor] how to read two files and substitute

2011-05-17 Thread Michiel Overtoom
On 2011-05-17 18:47, lina wrote: A further question: I don't know how can I get the final output is unique? Unique in what way? You mean that in file1 (confout.pdb?) there could be more values for the same key? or should duplicate lines in the output be condensed to one line? Maybe if you w

Re: [Tutor] how to read two files and substitute

2011-05-17 Thread Michiel Overtoom
On 2011-05-17 15:42, lina wrote: > I want to get the $4(column 4) value which has the $1 value. for > values in file2 Have you tried to write some code yourself already? Please show it. Anyway, I'd proceed with something like this: mapping={} for line in open("file1").readlines(): parts=

Re: [Tutor] Titles from a web page

2011-05-04 Thread Michiel Overtoom
On May 5, 2011, at 07:16, James Mills wrote: > On Thu, May 5, 2011 at 1:52 PM, Modulok wrote: >> You might look into the third party module, 'BeautifulSoup'. It's designed to >> help you interrogate markup (even poor markup), extracting nuggets of data >> based >> on various criteria. > > lxml

Re: [Tutor] RE

2011-04-06 Thread Michiel Overtoom
On 2011-04-06 11:03, JOHN KELLY wrote: I need help. In that case, start with http://wiki.python.org/moin/BeginnersGuide -- "Lots of people have brilliant ideas every day, but they often disappear in the cacophony of life that we muddle through." - Evan Jenkins, http://arstechnica.com/aut

Re: [Tutor] class attribute to initiate more classes

2009-10-30 Thread Michiel Overtoom
On 31 Oct 2009, at 06:01 , Vincent Davis wrote: I hope this makes sense, I am sure there is a term for what I am trying to do but I don't know it. What a strange program. But at least it compiles: import random class people: def __init__(self, size): self.size = size class mak

Re: [Tutor] ok i need some help with a for loop

2009-10-15 Thread Michiel Overtoom
Skylar Struble wrote: lookwords = ['look', 'examine', 'investigate','open') The ')' probably has to be a ']'. if word and word2 in input1: Try this: if (word in input1) and (word2 in input1): it prints out all of the print things 2 times when i want it to print 1 or the other

Re: [Tutor] weather scraping with Beautiful Soup

2009-07-18 Thread Michiel Overtoom
Sander Sweers wrote: 2009/7/18 Che M : table = soup.find("table","dataTable tm10") #find the table tbody = table.find("tbody") #find the table's body You can do this in one step. tbody = soup.find('tbody') Yeah, but what if the document contains multiple tables, and you w

Re: [Tutor] weather scraping with Beautiful Soup

2009-07-17 Thread Michiel Overtoom
Che M wrote: "http://www.wund.com/cgi-bin/findweather/getForecast?query=Worthington%2C+OH"; > Any help is appreciated. That would be: daytemp = soup.find("div",id="main").findNext("span").renderContents() -- "The ability of the OSS process to collect and harness the collective IQ of tho

Re: [Tutor] weather scraping with Beautiful Soup

2009-07-17 Thread Michiel Overtoom
Che M wrote: Thanks, but that isn't working for me. That's because BeautifulSoup isn't able to parse that webpage, not because the statement I posted doesn't work. I had BeautifulSoup parse the HTML fragment you posted earlier instead of the live webpage. This is actually the first time I se

Re: [Tutor] weather scraping with Beautiful Soup

2009-07-17 Thread Michiel Overtoom
Che M wrote: The 60.3 is the value I want to extract. soup.find("div",id="curcondbox").findNext("span","b").renderContents() -- "The ability of the OSS process to collect and harness the collective IQ of thousands of individuals across the Internet is simply amazing." - Vinod Valloppillil ht

Re: [Tutor] help

2009-07-15 Thread Michiel Overtoom
jonathan wallis wrote: i cant figure out if there is a way to make so if one loop ends it says something different than if the other loop ends. Maybe you could use two separate tests and break out of the loop if x or y gets too low. Because the tests are separated you could say something diff

Re: [Tutor] reading complex data types from text file

2009-07-15 Thread Michiel Overtoom
Chris Castillo wrote: I don't know how to iterate through all the lines and just get the integers and store them or iterate through the lines and just get the names and store them. You could use the int() function to try to convert a line to an integer, and if that fails with a ValueError ex

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Michiel Overtoom
Daniel Sato wrote: am having some trouble with the first "If" Don't forget the colon at the end of the line. if condition: pass Greetings, -- "The ability of the OSS process to collect and harness the collective IQ of thousands of individuals across the Internet is

Re: [Tutor] is it possible to traverse two lists simulatenously using python

2009-04-30 Thread Michiel Overtoom
Kent Johnson wrote: Use zip() or itertools.izip(): And when the sequences are of unequal length: topgirls=["Ann","Mary","Casey","Zoe"] richgirls=["Britt","Susan","Alice"] print "\nUsing zip()" for i,j in zip(topgirls,richgirls): print i,j print "\nUsing map()" for i,j in map(None,topgir

Re: [Tutor] Printing the code of a function

2008-12-28 Thread Michiel Overtoom
wormwood_3 wrote: > I am wondering if there is a way to > print out the code of a defined function. When Python compiles source code, it doesn't store the source code itself; only the compiled intermediate code. With the 'dis' package you can disassemble that: def foo(): print "Show me

Re: [Tutor] Unable to Reconfigure IDLE

2008-07-26 Thread Michiel Overtoom
Thomas wrote... >Running IDLE 1.2.2 under MacPython 2.5 on Mac OS X 5.1. > >Configured shell window to wrong size, now can't seem to find the menu >(Options > Configure) to resize the shell. > >Tried going to username > Library > Preferences and removing >org.python* files, but that did not w

Re: [Tutor] List indexing problem

2008-07-25 Thread Michiel Overtoom
Mike wrote... >Do you happen to know if there is an efficient way to initialize a list >like this without explicitly writing out each element? >>> temp = [[0, 0, 0],[0, 0, 0],[0, 0, 0]] >>> print temp [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> print [[0]*3]*3 [[0, 0, 0], [0, 0, 0], [0, 0, 0]] --

Re: [Tutor] %(value1, value2) what does this returns

2008-07-22 Thread Michiel Overtoom
Vishwajeet wrote... > I want to know in this % (symbol, stat) returns In itself it returns nothing. The '%' is used as the 'string interpolation operator' here. http://docs.python.org/lib/typesseq-strings.html >>> print "%d kilos of %s for %f euro" % (2,"mangos",3.75) 2 kilos of mangos for 3.7

Re: [Tutor] adding a watermark to a sequence of images

2008-07-20 Thread Michiel Overtoom
Christopher wrote... > Has anyone used Python to watermark of sequence of images? No, but I have used PIL (Python Image Library) to do other things to batches of images, like resizing or printing statistics on it. Maybe you can get some ideas from these; maybe you can combine them with a watermar

Re: [Tutor] Guidance on jump-starting to learn Python

2008-07-18 Thread Michiel Overtoom
Setve wrote... > I have the challenge / opportunity to learn Python quickly. I > am technically-minded, but I am not a programmer. You have seen the page http://wiki.python.org/moin/BeginnersGuide, and more specific, http://wiki.python.org/moin/BeginnersGuide/NonProgrammers ? Ans of course, you

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread Michiel Overtoom
josetjr wrote... >Hello, I am taking python this summer, and have run into a problem. Let me suggest some improvements. You can process all the lines in a textfile like this: for line in open("dates.txt").readlines(): print line Furthermore, if you have a string in the form of

Re: [Tutor] Tree Ctrl Data Structure - Help, please!

2008-07-15 Thread Michiel Overtoom
Lauren wrote... > Based on some research I've done, I think I want my data structure to > be a series of lists within lists: > [...] > Can someone give me some pointers on how to think about this > clearly?? I'm obviously missing some steps!! :-( I find your example a bit hard to follow. From

Re: [Tutor] Anyone using tarfile?

2008-07-15 Thread Michiel Overtoom
Terry wrote... > Well, I've been programming long enough that I tend to assume the > opposite: "I must be doing something wrong." Yes indeed ;-) Don't forget that thousands (if not millions) of individuals all across the internet are using Python and harnessing their collective IQ to squash eve

Re: [Tutor] accessing string in list

2008-07-15 Thread Michiel Overtoom
Bryan wrote... >I have a list of labels for a data file, >test = ['depth', '4', '6', '10', '15', '20', '30', '40', 'angle'] >If I have 15.8, I would like to get the index of '20' and '15'. I would >also like to make sure that my known value falls in the range 4-40. Python has a standard module '

Re: [Tutor] Program launcher in taskbar

2008-07-13 Thread Michiel Overtoom
Ammar wrote... > Is is possible to place my program icon in the system tray portion > of the taskbar (like instant messaging applications)? > The program will be launched by clicking on the icon. How to > do this in python and which module should I use? Are you on a Windows machine? Then you

Re: [Tutor] Another assert() question

2008-07-12 Thread Michiel Overtoom
Dick wrote: > I was hoping to put some sort of explanation of failure in an > assert statement. But how to do it? > So I'd like to know what that 'expression' in the syntax can be, > and how to use it. I think it would help if you separate the detection of duplicate colors from the assert state

Re: [Tutor] Float number accuracy

2008-07-10 Thread Michiel Overtoom
On 10-jul-2008, at 22:41, Julia wrote: >>> c = 3.3 >>> c 3.2998 I've done it with and without the c = float and still it rounds the number down. Why? And more importantly: is it possible to make Python more accurate? I need the exact number and not something close to it for