> -Oprindelig meddelelse-
> Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
> [mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På
> vegne af Alan Gauld
> Sendt: 29. september 2011 10:48
> Til: tutor@python.org
> Emne: Re: [Tutor] where to look for python codes
>
> On 2
> -Oprindelig meddelelse-
> Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
> [mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne
> af Alan Gauld
> Sendt: 6. juni 2011 11:51
> Til: tutor@python.org
> Emne: Re: [Tutor] search-replace
>
Hi tutors
If I need to clean a textfile (perhaps after web scraping), I have used this
method - without problems - but I'm sure there must be smarter and better
ways.
I'm especially interested to know how I do more than just one search-replace
without having to repeat the whole step below.
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af
Susana Iraiis Delgado Rodriguez
Sendt: 28. marts 2011 17:12
Til: tutor@python.org
Emne: [Tutor] Write new line(enter) in txt
Hello list!!
This is a very simpl
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af
Victor Binns
Sendt: 1. februar 2011 01:19
Til: Tutor python
Emne: [Tutor] Need Help in installing MySQLdb-Python
I have Python 2.6.3
I went to the following
> >I get a invalid syntax error when I try to run this script - and it's
> > con.commit() which is highlighted when I get the error.
>
> Aren't you one closing parenthesis short?
>
> Alan Gauld
Yes, you're absolutely right.
Thanks.
Tommy
___
Tutor ma
int(cols[2]),
int(cols[3]), int(cols[4]), int(cols[5]), int(cols[6]), int(cols[7]))
con.commit()
except:
con.rollback()
con.close()
Tommy Kaas
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Yes youre right!
Thanks,
Tommy
Fra: Jason Staudenmayer [mailto:jas...@adventureaquarium.com]
Sendt: 12. januar 2011 16:50
Til: Tommy Kaas; tutor@python.org
Emne: RE: [Tutor] how avoid writing a newline?
You should have a comma after the "#" in the highlighted print state
I'm using Activepython 2.6.6 on PC/Win7
I have made a small scraper script as an exercise for myself.
It scrapes the name and some details of the first 25 billionaires on the
Forbes list.
It works and write the result in a text file, with the columns separated by
"#"
It takes the name from
You have 3 options, string concatenation, and two styles of formatting:
>>> name = 'Sir Arthur'
>>> '.*' + name + '.*'
'.*Sir Arthur.*'
>>> '.*%s.*' % (name, )
'.*Sir Arthur.*'
>>> '.*{0}.*'.format(name)
'.*Sir Arthur.*'
>>> '.*{name}.*'.format(name=name)
'.*Sir Arthur.*'
The last t
I try to write a program, where the user can write a word or a name and I
will tell how many times the subject was mentioned in a text, I'm hosting.
I guess it's possible but not this way it seems?
The re is only searching for the word "name" and not the variable name
I'm using Python 2.6.6.
TI
0'}):
tds = row('td')
output = ";".join(tds[i].string for i in (0, 1, 2, 3, 4))
f.write(output + '\n')
f.close()
Tommy Kaas
Kaas & Mulvad
Lykkesholms Alle 2A, 3.
1902 Frederiksberg C
Mobil: 27268818
Mail: <
on.org
> [mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På
> vegne af Peter Otten
> Sendt: 29. december 2010 11:46
> Til: tutor@python.org
> Emne: Re: [Tutor] scraping and saving in file
>
> Tommy Kaas wrote:
>
> > I’m trying to learn basic web scr
Steven D'Aprano wrote:
> But in your case, the best way is not to use print at all. You are writing
to a
> file -- write to the file directly, don't mess about with print. Untested:
>
>
> f = open('tabeltest.txt', 'w')
> url = 'http://www.kaasogmulvad.dk/unv/python/tabeltest.htm'
> soup = Beautif
Kommunenr # Kommune # Region # Regionsnr
101 # København # Hovedstaden # 1084
147 # Frederiksberg # Hovedstaden # 1084
151 # Ballerup # Hovedstaden # 1084
153 # Brøndby # Hovedstaden # 1084
155 # Dragør # Hovedstaden # 1084
Thanks in advance
Tommy Kaas
Kaas & Mulvad
Thanks for the explanation. It's clearer now.
Tommy
"Tommy Kaas" wrote
> > > for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
> >
> >Do you understand the syntax from a Python point of view?
>
> No.
-Oprindelig meddelelse-
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af
Alan Gauld
Sendt: 28. juli 2010 20:00
Til: tutor@python.org
Emne: Re: [Tutor] Newbie question - syntax - BeautifulSoup
"Tommy
n't understand how I am supposed to the fourth line - after "for
row in soup". I can clearly see it defines the area I want to scrape, but
how is the syntax build? And almost as important - where should I have found
that information myself? I have tried to read the help-file of
Bea
18 matches
Mail list logo