Save data to a file thru a http connection

2006-05-31 Thread yinglcs
Hi,

I am new to python. I read an example here about how to fetch data thru
a HTTP connection:
http://diveintopython.org/http_web_services/review.html,

My question is how can i save the data to a file after reading it from
a http connection.

Thank you.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Save data to a file thru a http connection

2006-05-31 Thread yinglcs
Scott,

Can you please tell me which chapter of the tutorial that you are
referring to http://docs.python.org/tut/tut.html?

The only chapter that I find about http is chapter 10.7, but it does
not have the example that you are referring to

Scott David Daniels wrote:
> [EMAIL PROTECTED] wrote:
> > I am new to python. I read an example here about how to fetch data thru
> > a HTTP connection:
> > http://diveintopython.org/http_web_services/review.html,
> >
> > My question is how can i save the data to a file after reading it from
> > a http connection.
>
> Do the tutorial and this and many other things will become clear.
>
> Instead of just "print sometext", do something like:
>  ...
>  f = open('filename', 'w')
>  ...
>  print >>f, sometext
>  ... (possibly more prints like the above).
>  f.close()
> 
> --Scott David Daniels
> [EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


How to extract 2 integers from a string in python?

2006-06-08 Thread yinglcs
Hi,

how can I extract 2 integers from a string in python?

for example, my source string is this:
Total size: 173233 (371587)

I want to extract the integer 173233 and 371587 from that soource
string, how can I do that?

-- 
http://mail.python.org/mailman/listinfo/python-list


How to check if a directory is exist in python?

2006-03-19 Thread yinglcs
I check the documentation here, but it does not say how to check if a
directory is exist in python?
http://docs.python.org/lib/os-file-dir.html

And why mkdir fails if the directory already exists?

Thank you.

-- 
http://mail.python.org/mailman/listinfo/python-list


How can I compare if 2 files has duplicate entries in python?

2006-03-21 Thread yinglcs
I am new to python. How can I compare if 2 files has duplicate entries
in python?
Is there an example for that?  What if the files are big and I don't
want to read the whole file in memory.

Thank you.

-- 
http://mail.python.org/mailman/listinfo/python-list