Thankyou sir it is working.but one more thing i want to ask that if my
file will have entries like:---
fileA and fileB
12 10
13 12
14
15
means if their no. of entries will not match then how to combine them(both
input files have more than one column).
Thanks,
Amrita
>> Maybe
join with generator expression is what was needed. terrific!
From: Rich Lovely
Sent: Friday, July 17, 2009 4:19 PM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] large strings and garbage collection
2009/7/17 Dinesh B Vadhia :
> This was discussed in a previous post but I di
> Date: Sat, 18 Jul 2009 01:09:32 +0200
> From: sander.swe...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] weather scraping with Beautiful Soup
>
> 2009/7/17 Che M :
> > table = soup.find("td",id="dataTable tm10")
>
> Almost right. attrs should normall be a dict so {'class':'dataTab
On Fri, Jul 17, 2009 at 5:10 PM, wrote:
>
>
> On Fri Jul 17 17:51 , Wayne sent:
>
> >On Fri, Jul 17, 2009 at 1:55 PM, wrote:
> >
> >
> >
> >
> >I have a form and script that works. I can enter values into the fields,
> however
> >
> >the data will not show up on the server in the text file. Th
2009/7/17 Dinesh B Vadhia :
> This was discussed in a previous post but I didn't see a solution. Say, you
> have
>
> for i in veryLongListOfStringValues:
> s += i
>
> As per previous post
> (http://thread.gmane.org/gmane.comp.python.tutor/54029/focus=54139),
> (quoting verbatim) "... the follo
2009/7/17 Che M :
> table = soup.find("td",id="dataTable tm10")
Almost right. attrs should normall be a dict so {'class':'dataTable
tm10'} but you can use a shortcut, read on.
>
>
> When I look at the page source for that page, there is this section, which
> contains the
> Maybe you could break that up a bit? This is the tutor list, not a
> one-liner competition!
rather than one-liners, we can try to create the most "Pythonic"
solution. below's my entry. :-)
cheers,
-wesley
myMac$ cat parafiles.py
#!/usr/bin/env python
from itertools import izip
from os.path im
2009/7/17 :
> Hi, I am reading values from a form and writing them to a text file. I keep
> getting
> a syntax error for outfile=open("filename", "a")I cant see it, does any body
> else.
>
>
> fileName = "requests.txt"
> # Create instance of FieldStorage
> Form = cgi.FieldStorage()
>
> # Get dat
"Dinesh B Vadhia" wrote
This was discussed in a previous post but I didn't see a solution. Say,
you have
for i in veryLongListOfStringValues:
s += i
In general avoid string addition.
(Although recent versions of Python have optimised it somewhat)
As s gets very large, how do you dea
wrote
I have a form and script that works. I can enter values into the fields,
however
the data will not show up on the server in the text file. The properties
for the
file is 0777. Can the form cause this problem?
Does the problem only occur when running it on the web server
or does it oc
This was discussed in a previous post but I didn't see a solution. Say, you
have
for i in veryLongListOfStringValues:
s += i
As per previous post
(http://thread.gmane.org/gmane.comp.python.tutor/54029/focus=54139), (quoting
verbatim) "... the following happens inside the python interpret
OK, got the very basic case to work when using Beautiful Soup 3.0.7a and
scraping the Weather Underground Lite page. That gives me the current
temperature, etc. Good.
But now I would like the average temperature from, say, yesterday. I am again
having trouble finding elements in the soup.
On 7/17/2009 1:27 PM Kent Johnson said...
On Fri, Jul 17, 2009 at 3:14 PM, Emile van Sebille wrote:
delim= '\t'
file('ala', 'w').writelines(
[ delim.join([ii,jj] for ii,jj in
zip(
[xx.strip() for xx in
file('/home/amrita/alachems/chem2.txt','r').readlines()
],
file(
On Fri, Jul 17, 2009 at 3:14 PM, Emile van Sebille wrote:
> delim= '\t'
>
> file('ala', 'w').writelines(
> [ delim.join([ii,jj] for ii,jj in
> zip(
> [xx.strip() for xx in
> file('/home/amrita/alachems/chem2.txt','r').readlines()
> ],
> file('/home/amrita/pdbfile/pdb2.t
On 7/17/2009 11:37 AM amr...@iisermohali.ac.in said...
Hi,
I have two large different column datafiles now i want to join them as
single multi-column datafile:--
I tried the command:--
file('ala', 'w').write(file('/home/amrita/alachems/chem2.txt',
'r').read()+file('/home/amrita/pdbfile/p
wrote
but it is priniting second file after first, whereas i want to join them
columwise like:---
FileA FileB FileC
12 14 12 14
15 + 16 = 15 16
18 17 18 17
20 19 20 19
I'm not sure what the plus sign in the second line signifies
but otherwise it look
I have a form and script that works. I can enter values into the fields,
however
the data will not show up on the server in the text file. The properties for
the
file is 0777. Can the form cause this problem?
28359-form method.docx
Description: Binary data
__
I have a form and script that works. I can enter values into the fields,
however
the data will not show up on the server in the text file. The properties for
the
file is 0777. Can the form cause this problem?
http://web.nmsu.edu/~keithabt/cgi-bin/07_index.cgi";>
Please feel out the entire form
> 2009/7/17 Michiel Overtoom :
> > This is actually the first time I see that BeautifulSoup is NOT able to
> > parse a webpage...
>
> Depends on which version is used. If 3.1 then it is much worse with
> malformed html than prior releases. See [1] for more info.
>
> Greets
> Sander
>
> [1] htt
Thanks for the replies. I think my mistake was assuming that "1" meant
"true" when if fact it means "index 1". Whe I tested for "== 1", since
"Source Height" was coincidentally at index 1 it returned something
which looked like it worked. Thanks for the clarification. And thanks
for the suggest
Hi,
I have two large different column datafiles now i want to join them as
single multi-column datafile:--
I tried the command:--
>>> file('ala', 'w').write(file('/home/amrita/alachems/chem2.txt',
'r').read()+file('/home/amrita/pdbfile/pdb2.txt', 'r').read())
but it is priniting second file
> Date: Fri, 17 Jul 2009 20:02:22 +0200
> From: mot...@xs4all.nl
> To: tutor@python.org
> CC: pine...@hotmail.com
> Subject: Re: [Tutor] weather scraping with Beautiful Soup
>
> Che M wrote:
>
> > "http://www.wund.com/cgi-bin/findweather/getForecast?query=Worthington%2C+OH";
> >
> > Any help
2009/7/17 Michiel Overtoom :
> This is actually the first time I see that BeautifulSoup is NOT able to
> parse a webpage...
Depends on which version is used. If 3.1 then it is much worse with
malformed html than prior releases. See [1] for more info.
Greets
Sander
[1] http://www.crummy.com/softw
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
> Date: Fri, 17 Jul 2009 08:09:10 -0400
> Subject: Re: [Tutor] weather scraping with Beautiful Soup
> From: ken...@tds.net
> To: pine...@hotmail.com
> CC: tutor@python.org
>
> On Thu, Jul 16, 2009 at 11:21 PM, Che M wrote:
> > Hi,
> >
> > I am interested in gathering simple weather data using B
Chris Castillo wrote:
how would i go about adding the names to a dictionary as a key and the
scores as a value in this code?
# refactored for better use of Python, correct logic, and flow
scores = {} # empty dictionary
total = 0
for line in open("bowlingscores.txt", "r"):
if line.strip().
pedro wrote:
> Hi I have been trying to understand a python script and I keep coming
> across this kind of structure
> that says "If it is not equal to negative one"
>
>
> for line in theLines:
>if line.find("Source Height") != -1:
> #etc...
> #
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
On Fri, Jul 17, 2009 at 12:43 PM, wrote:
> Hi, I am reading values from a form and writing them to a text file. I keep
> getting
> a syntax error for outfile=open("filename", "a")I cant see it, does any body
> else.
Indentation problems can cause mysterious syntax errors. Use a text
editor that
> Date: Fri, 17 Jul 2009 12:27:36 +0200
> From: mot...@xs4all.nl
> To: tutor@python.org
> CC: pine...@hotmail.com
> Subject: Re: [Tutor] weather scraping with Beautiful Soup
>
> Che M wrote:
>
> > The 60.3 is the value I want to extract.
>
> soup.find("div",id="curcondbox").findNext("span","b
On 7/17/2009 9:43 AM keith...@beyondbb.com said...
Hi, I am reading values from a form and writing them to a text file. I keep getting
a syntax error for outfile=open("filename", "a")I cant see it, does any body else.
There isn't an error in the statement. Try to pare down your code to a
sh
On Fri, Jul 17, 2009 at 12:04 PM, Amit Sethi wrote:
> now I have created a class with some functions defined in it but the
> thing is that they are named in a completely different manner?(or
> so I think)
>
> <__main__.SmPriceWindow instance at 0x9dd448c>
> ['_SmPriceWindow__add_columns', '_Sm
Hi, I am reading values from a form and writing them to a text file. I keep
getting
a syntax error for outfile=open("filename", "a")I cant see it, does any body
else.
fileName = "requests.txt"
# Create instance of FieldStorage
Form = cgi.FieldStorage()
# Get data from fields
if Form and Form
2009/7/17 pedro :
>
> for line in theLines:
> if line.find("Source Height") != -1:
> #etc...
> ###
>
> Is there some special reason for this. Why not just write "If it is equal to
> one"
Yes, str.find() returns -1 on failure. See b
On Fri, Jul 17, 2009, pedro wrote:
> Hi I have been trying to understand a python script and I keep coming
> across this kind of structure
> that says "If it is not equal to negative one"
>
>
> for line in theLines:
>if line.find("Source Height") != -1:
> #etc
Hi I have been trying to understand a python script and I keep coming
across this kind of structure
that says "If it is not equal to negative one"
for line in theLines:
if line.find("Source Height") != -1:
#etc...
###
Is there
On Fri, Jul 17, 2009 at 11:42 AM, Sander Sweers wrote:
> import time
>
> today = time.localtime()
> datestr = time.strftime("%Y%m%d",today)
> ext = ".tab"
>
> print datestr + ext
You can include literal characters in the format string:
In [4]: time.strft
I am not able to understand this , perhaps it is an aspect of python I
do not understand
Now usually I would think that for a class
class a:
... def __init__(self):
... pass
... def __something__(self):
... pass
>>> b=a()
>>> dir(b)
['__doc__', '__init__', '__
2009/7/17 Matt Herzog :
> Hello All.
>
> I need to use paramiko to sftp get a single file from a remote server.
> The remote file's base name will be today's date (%Y%m%d) dot tab.
> I need help joining the today with the .tab extension. Do I need globbing?
>
> example: 20090716.tab
>
> #!/usr/bin/
Hello All.
I need to use paramiko to sftp get a single file from a remote server.
The remote file's base name will be today's date (%Y%m%d) dot tab.
I need help joining the today with the .tab extension. Do I need globbing?
example: 20090716.tab
#!/usr/bin/env python
import paramiko
import glob
On Fri, Jul 17, 2009 at 2:12 AM, barış ata wrote:
> hi,
> i'm writing a log client to recieve logs from socket connection and display
> on a textbox
> now i have a few question
> i used Pmw.ScrolledText but i don't now its buffer size. how can i limit
> it?
> and i want to create a log file with
Che M wrote:
>
>
> West of Town, Jamestown, Pennsylvania
> (PWS)
> Updated: pwsid="KPAJAMES1" pwsunit="english" pwsvariable="lu" value="1247814018">3:00
> AM EDT on July 17, 2009
>
>
>
>
>
On Thu, Jul 16, 2009 at 11:21 PM, Che M wrote:
> Hi,
>
> I am interested in gathering simple weather data using Beautiful Soup, but
> am having trouble understanding what I'm doing. I have searched the
> archives and so far haven't found enough to get me moving forward.
>
> Basically I am trying t
hi,
i'm writing a log client to recieve logs from socket connection and display
on a textbox
now i have a few question
i used Pmw.ScrolledText but i don't now its buffer size. how can i limit
it?
and i want to create a log file with logging module but i want to limit log
size
for example if user s
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
> The posts basocally say go and look at the HTML and find the
> right tags for the data you need. This is fubndamental to any kind of web
> scraping, you need to understand the HTML tree well enough to identify
> where yourt data exists.
>
> How familiar are you with HTML and its structures?
R
46 matches
Mail list logo