d readings ?-- James Yu[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hi folks,
I tried to open some web pages with urllib2.Request(url, data, headers), but
it always give me a 404 error.
Eg.
url = 'http://www.whatever.com/somephp.php'
data = {}
data['id'] = account
for i in book2Open:
data['book'] = i
url_data = urllib.urlencode(data)
request = urllib2.
This is part of my code that invokes urllib.urlretrieve:
> for i in link2Visit:
> localName = i.split('/')
> i = i.replace(' ', '%20')
> tgtPath = ['d:\\', 'work', 'python', 'grab_n_view']
> localPath = ''
> for j in tgtPath:
> localPath = os.path.join(localPath, j)
>
I am using *fileHandle = open(srcFile, 'w')* + *fileHandle.write('whatever')
* to put text into a file, and Python uses utf-8 encoding by default.
How do I configure or do anything to make Python writing files in ansi
encoding ?
--
This is a UTF-8 formatted mail
--
I just figure out the how-to:
# first we open and read in chars as in utf-8 encoding
ansiLine = line.decode('utf-8', 'ignore')
# then writing it into another file in any encoding you like, it's big5 in
my case.
src_handle.write(ansiLine.encode('big5', 'ignore'))
--
This is a UTF-8 formatted mail
I tried to update the rectangle on a canvas to get the visual effect of
progressbar.
It works all right if I delete the existing objects (rectangle and text) and
create a new one.
However, if I invoke canvas.itemconfig() to update the existing objects'
options, gui just went nuts.
I am more than ha
Hi folks,
I prepared a python script for dynamically get the absolute paths of the
files in certain folder.
Then I tried to invoke that function from my web server in a .psp file like
this:
1
2
3 asdfasdfasdfa
4
5 <%
6 import glob
7 import os
8 *
I am using "mod_python.publisher" to generate my web page that contains
serveral links to local files.
I also replace the path with my domain name like this:
curDir = os.path.dirname(__file__)
link = 'http://' + hostname + '/' + os.path.basename(curDir) + '/'
files = os.listdir(curDir)
for i in fi