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,topgirls,richgirls):
print i,j


--
"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
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 simply amazing." - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 exception, assume that it is a name.


names=[]
numbers=[]
for line in open("mixed.txt"):
try:
nr=int(line)
# it's an integer
numbers.append(line)
except ValueError:
# it's not an integer
names.append(line)

f=open("numbers.txt","wt")
f.write("".join(numbers))
f.close()

f=open("names.txt","wt")
f.write("".join(names))
f.close()



--
"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
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 different for 
each case.

For example:

import random

x=y=9
while True:
print "x is %d, y is %d" % (x,y)
if x<=0:
print "Loop stopped because X was too low"
break
if y<=0:
print "Loop stopped because Y was too low"
break
# do something with x and y
if random.random()>0.5:
x-=1
else:
y-=1


--
"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
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 see that BeautifulSoup is NOT able to 
parse a webpage...


Greetings,

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 thousands of individuals across
the Internet is simply amazing." - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 want 
explicitely the one with the class 'dataTable tm10'?


In such a case it doesn't hurt to progressively narrow down on the 
wanted element.


It also makes the scrape code more robust against page changes. Someone 
could add an extra table to the start of the page to host a search box, 
for example.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 because what im trying to do is see if the input1 has
both an item from items and lookwords in the string and if so print
you look in the map or if it finds 1 or none to print sorry you used a
word i didnt understand


Some interpunction would make this text easier to understand.


--
"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
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 makepeople:
def __init__(self, randomsize):
self.rsize = randomsize
self.allpeople = []
def makethem(self):
for x in range(self.rsize):
self.allpeople.append(people(self.rsize))

listofp = makepeople(int(random.gauss(100, 2)))
listofp.makethem()


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 my new application.


That's because floats have only a fixed amount of bits to represent  
values, and not all values can be represented exactly, so there  
occurs some rounding errors.


Python can do exact math using the 'decimal' package. See
http://www.python.org/doc/2.4.3/lib/module-decimal.html

Greetings,
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 statement.
It all looks a bit convoluted now, and I'm missing the context in which this
all happens.
First detect the presence of duplicate colors in a True/False variable, then
use that variable in an assert.

Oh, and by the way, you don't have to convert a set to list to be able to
take it's length.

  colors=["red","blue","green","blue","yellow","blue"]
  duplicatesfound = len(set(colors)) != len(colors)
  assert not duplicatesfound, "A color has been used more than once"

Exercise left for the reader: Report which colors were used more than once.

And do me a favor, post in plain text, not HTML.

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 might want to look at the
'win32gui_taskbar.py' example in the
'C:\Ap\Python\Lib\site-packages\win32\Demos' directory. This assumes you
have Mark Hammond's "Python for Windows Extensions" installed:
http://sourceforge.net/projects/pywin32/

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 'bisect' for that. To get past the string
trouble, you could convert the array on the fly to floats (without the first
and last label, that is). Why not build your labels as a list with numbers
first, then later add the strings at the beginning and the end?  And did you
know that lists can contain both strings and numbers at the same time?

Example:


import bisect

# simple
numbers=[4, 6, 10, 15, 20, 30, 40]
candidate=15.8
print 'insert %g before the %dth element in %s' %
(candidate,bisect.bisect_left(numbers,candidate),numbers)

# complication with strings instead of numbers:
labels=['depth', '4', '6', '10', '15', '20', '30', '40', 'angle']
candidate='15.8'
can=float(candidate)
if can<4 or can>40: raise ValueError('The candidate must be in the range 4-40')
position=bisect.bisect_left([float(x) for x in labels[1:-1]],can)+1
print 'insert %s before the %dth element in %s' % (candidate,position,labels)


prints:

insert 15.8 before the 4th element in [4, 6, 10, 15, 20, 30, 40]
insert 15.8 before the 5th element in ['depth', '4', '6', '10', '15', '20',
'30', '40', 'angle']


Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 every bug that occurs. It's simply amazing hard to find a new bug.


-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 the node names I can't
determine a logical hierarchy; it might be the formatting of the email message.
Could you express the way you get your query results in terms of the below
geography names?  Then maybe I can think up a way how to combine those lists
into a tree.

# start of example

# this example uses a hierarchy of three levels: 1) continent, 2)
country/state, and 3) city
geo=[
"australia",
"europe",[
"spain",
"germany",
"belgium",
],
"america",[
"california",[
"los angeles",
"san francisco",
"berkeley"
],
"texas",
"utah"
],
"asia"
]

print "Our geography as a flat list:\n"
print geo


def printlist(lst,indent=0):
for item in lst:
if isinstance(item,(list,tuple)):
printlist(item,indent+1)
else:
print "  -> "*indent, item


print "\nOur geography as a tree:\n"
printlist(geo)

# end of example


This prints:

Our geography as a flat list:

['australia', 'europe', ['spain', 'germany', 'belgium'], 'america',
['california', ['los angeles', 'san francisco', 'berkeley'], 'texas',
'utah'], 'asia']

Our geography as a tree:

 australia
 europe
  ->  spain
  ->  germany
  ->  belgium
 america
  ->  california
  ->   ->  los angeles
  ->   ->  san francisco
  ->   ->  berkeley
  ->  texas
  ->  utah
 asia

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 "ABC=DEF", you can split it
like this:

key,value=s.split("=")

To enumerate the keys of a dictionary in alphabetical order, you can use:

for k in sorted(d):
print k

So, your little homework program becomes more pythonic like this:

history={}
for line in open("dates.txt").readlines(): 
line=line.strip("\n\"") # clean the line a bit; strip off the newline
and quotes
date,event=line.split("=")
history[date]=event

for k in sorted(history):
print k,history[k]


Have a nice day,



-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 can always ask the mailinglist if you feel that you're
hitting a wall ;-)

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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
watermarking library.

--- ShowImageDimensions.py

import os,sys,Image

# See http://www.pythonware.com/library/pil/handbook/introduction.htm

def showdimension(filename):
im=Image.open(filename)
print filename,im.size

for infile in os.listdir('.'):
f, e = os.path.splitext(infile)
if (e=='.tga' or e=='.jpg' or e=='.gif' or e=='.bmp'):
showdimension(infile)



--- WoWScreenshotConverter.py

# this converts all TGA's in the current ditectory to JPG's, full-, half-
and small size versions.
# I wrote this in the time when World of Warcraft could not save screenshots
in JPG format.


import os,sys,Image

# See http://www.pythonware.com/library/pil/handbook/introduction.htm

def convert(basename):
print 'Converting',basename
im=Image.open(basename+'.tga')
im.save(basename+'-full.jpg')
# halfsize=tuple(map(lambda x: x/2,im.size))
halfsize=tuple([x/2 for x in im.size])
im.thumbnail(halfsize,Image.ANTIALIAS)
im.save(basename+'-half.jpg')
thumbsize=128,128
im.thumbnail(thumbsize,Image.ANTIALIAS)
im.save(basename+'-small.jpg')


# convert('WoWScrnShot_123005_091926.tga')
for infile in os.listdir('.'):
f, e = os.path.splitext(infile)
if (e=='.tga'):
convert(f)

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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.75 euro

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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]]


-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 work.

IDLE keeps it preferences in a hidden directory '.idlerc' in your home
directory. 

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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 the money."

import dis
dis.dis(foo)

>>>
  2   0 LOAD_CONST   1 ('Show me the money.')
  3 PRINT_ITEM
  4 PRINT_NEWLINE
  5 LOAD_CONST   0 (None)
  8 RETURN_VALUE
>>>


--
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


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/author/ohrmazd/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 is also work looking into which provides similar functionality.

For especially broken markup you might even consider version 3.07a of 
BeautifulSoup.  The parser in later versions got slightly less forgiving.

Greetings,

-- 
"Control over the use of one's ideas really constitutes control over other 
people's lives; and it is usually used to make their lives more difficult." - 
Richard Stallman

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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=line.strip().split()
mapping[parts[0]]=parts[3]
origs=open("file2").read().split()
print " ".join([mapping[orig] for orig in origs])

The output is "173 174 174". Since you provide no column names I can't 
use meaningful variable names. Are these very big files?  In that case 
another approach is maybe better.


Greetings,


--
"Good programming is not learned from generalities, but by seeing how
significant programs can be made clean, easy to read, easy to maintain
and modify, human-engineered, efficient, and reliable, by the application
of common sense and good programming practices. Careful study and
imitation of good programs leads to better writing."
- Kernighan and Plauger, motto of 'Software Tools'
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 were more descriptive with what your 
goal and your source data is, your programming problem is easier to solve.


[It could be that you're not comfortable discussing this on a public 
mailing list, but then, this is python-tutor.  If you require hands-on 
help with complex programming problems in your work field, or even just 
working solutions, it might be more advantageous to hire me as a remote 
consultant (€120 per hour) which will enable you to offload difficult 
programming problems on me, and if you want, I'll throw in some online 
Python lessons via Skype in as well ;-) ]


Greetings,


--
"Good programming is not learned from generalities, but by seeing how
significant programs can be made clean, easy to read, easy to maintain
and modify, human-engineered, efficient, and reliable, by the application
of common sense and good programming practices. Careful study and
imitation of good programs leads to better writing."
- Kernighan and Plauger, motto of 'Software Tools'

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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,
> I just joined this mailing list so that i can boost up my learning of 
> python.I come from a C background so python looks a little strange to me but 
> it is easier to learn then any other languages around.Yet,i have not been 
> able to find any cool books on python for peoples who are already 
> programmers.The ones which i found which i found were quite boring and 
> exhaustive.
> 
> Can you recommend a book for a person like me which comes with a C background 
> and the book covers all essential algoithmic methods and examples?
> 
> Thank you.

-- 
"Freedom: To ask nothing. To expect nothing. To depend on nothing." - Ayn Rand

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 achieve this.

> Just a question, but did you use Google before asking here? Because the first 
> hit when searching for "python html to pdf" looks like it should do what you 
> want.

Maybe for you, but not for the OP. Google will give different search results 
depending on your location, nationality, IP address and previous searches from 
that address.

Please post the URL of the first hit you got?

Greetings,

-- 
"Freedom: To ask nothing. To expect nothing. To depend on nothing." - Ayn Rand

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 this is what is known as an Internet Search Bubble.


> Another possibly quite relevant link is this one (about 20 lines of code): 
> http://www.linux.com/learn/docs/ldp/284676-converting-html-to-pdf-using-python-and-qt

Thank you for posting the links.

Greetings,

-- 
"If you don't know, the thing to do is not to get scared, but to learn." - Ayn 
Rand  



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 by the desire to achieve, not by the desire to 
beat others." - Ayn Rand

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 flowers! http://www.learn-the-flowers.com
or http://www.leer-de-bloemen.nl for the Dutch version.

Test je kennis van bloemen! http://www.leer-de-bloemen.nl
of http://www.learn-the-flowers.com voor de Engelse versie.




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor