Actually I am quite satisfied with and error, which is my expectation.
But the implicit global variable access seems quite uncomfortable to
me. Why is that necessary?
On Nov 3, 3:39 am, Stargaming <[EMAIL PROTECTED]> wrote:
> On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wro
I am confused by the following program:
def f():
print x
x=12345
f()
result is:
>>>
12345
however:
def f():
print x
x=0
x=12345
f()
result is:
Traceback (most recent call last):
File "...\test.py", line 5, in ?
f()
File "...\test.py", line 2, in f
print x
UnboundLocalEr
On Aug 8, 2:35 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Sullivan WxPyQtKinter <[EMAIL PROTECTED]> writes:
> > This program:
> > for i in range(10):
> > f.readline()
> > is absolutely every slow
>
> There are two problems:
I have a huge log file which contains 3,453,299,000 lines with
different lengths. It is not possible to calculate the absolute
position of the beginning of the one billionth line. Are there
efficient way to seek to the beginning of that line in python?
This program:
for i in range(10):
When the form in one HTML is very complex with a lot of fields(input,
button,radio,checkbox etc.), setting the environment is quite
burdernsome, so I usually change the stdout and stderr of the submit
processing script to a file object to see the output directly from that
file. This just can do, bu
title:Python CGI problem: correct result, but incorrect browser
response.
In one of my CGI program,named 'login.py', the script return a HEADER
to web browser:
Set-Cookie: sessionID=LAABUQLUCZIQJTZDWTFE;
Set-Cookie: username=testuser;
Status:302
Location:edit.py
(blank line)
but the IE prompted
I have been looking for python API documentation of BDBXML for quite a
few days but I could not find it. Anyone has any idea where it is? Or
if there is not such a thing at all, how could I get started?
In addition, in the previous posts I have seen some grumble about
python API's lack of XMLexcep
I do not know much about the HTML DOMBut I think if you just mean
treating HTML like XML and build it into a DOM tree and (Very
important) the HTML file is not a 1 lines or even longer one, then
go ahead to xml.dom.minidom module for help. It has a basic (and great)
implementation for light
Storing XML in relational database with indexing feature is exactly
what I need. But 4suite is mentioned from time to time and seemingly
holding better support for python. I have no idea if 4 suite has
provide strong support for random access or relatively random access
for XML database and with in
Perhaps what you have said is correct. But XML is more direct for
programmers and readers in my view point.
bayerj 写道:
> Mind, that XML documents are not more flexible than RDBMS.
>
> You can represent any XML document in a RDBMS. You cannot represent any
> RDBMS in an XML document. RDBMS are (st
a relation database has admiring search efficiency when the database is
very big (several thousands or tens of thousands of records). But my
current project is based on XML, for its tree-like data structure has
much more flexibility; and DOM, which could be manipulated just like a
tree. However, ho
In addition, f=file('filename','r');len(f.read()) is quite expensive in
my point of view, If the file is serveral MB or larger.
--
http://mail.python.org/mailman/listinfo/python-list
How to get the length of a file via build-in file object support? In
Visual Basic there is len(file) of something like that. But in python,
where is this property?
Sorry for this stupid question, if it is.
Thank you for help.
--
http://mail.python.org/mailman/listinfo/python-list
Well, in that case, the internal direction is just what I need. Thank
you so much for help.
--
http://mail.python.org/mailman/listinfo/python-list
As you said, There is no solution? I mean, tracing a real session
without using tricks like hidden field and cookies in CGI script?
Dennis Lee Bieber 写道:
> On 28 Mar 2006 09:40:24 -0800, "Sullivan WxPyQtKinter"
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.p
> Just read the name of the server (os.environ['SERVER_NAME']) to work
> out what absolute URL to redirect to, whist still being portable.
>
> Here's some code I dug up that should also cope with non-default ports
> and SSL, if that's of any use:
>
> ssl= os.environ.get('HTTPS', 'off') not in ('
I do not want to use Cookies in my site since not all web browser
support it well and sometimes people close cookie functioning for
security reasons.
I tried to add hidden field with a sessionID in every python CGI script
generated web pages, so everytime my client POST a request, the server
will
bruno at modulix 写道:
> Sullivan WxPyQtKinter wrote:
> > Python disappointly failed to provide a convinient cgi session
> > management module.
>
> Probably because there are much better options for web programming in
> Python ?
>
Really? Then what is it?
--
htt
Actually my project is converting certain specially costomized XML
file to HTML to display and edit. Sometimes the XML file is too big, or
the client upload a very huge file for the server to process, which
exceeds the processing ability of my server.(after all, it is a small
server on my poor lap
Python disappointly failed to provide a convinient cgi session
management module. Not willing to use external modules, I would like to
implement a simplest Session object on my own.
The basic problem is: how could a python CGI program understand several
requests are in the same session? Definately
Hi,there. Sometimes a python CGI script tries to output great
quantities of HTML responce or in other cases, it just falls into a
dead loop. How could my client close that CGI script running on the
server? I tried to use the STOP button in the web browser button, but
it does not work.
In addition,
Hi,there. Sometimes a python CGI script tries to output great
quantities of HTML responce or in other cases, it just falls into a
dead loop. How could my client close that CGI script running on the
server? I tried to use the STOP button in the web browser button, but
it does not work.
In addition,
I am now programming python scripts for CGI environment. The
redirection has been discussed in this forum for over one hundred
times. I have seen most of them, but still have some questions:
1. Are there any method (in python of course) to redirect to a web page
without causing a "Back" button tra
I am now using XML to record my lab records in quite a complex way, in
which about 80 tags are used to identify different types of data. I
think it is a good idea to search for a popular and mature XML search
engine before I started to program it myself:
I need the following functions:
Search and
Hi, I am now using minidom for my current development. I use cloneNode
method in Element object, but it just does not work. The test code is
very simple as follows:
=CODE==
from xml.dom.minidom import *
a=Element('see')
print a.toprettyxml()
b=a.cloneNode(True)
print b.toprett
IDLE is no longer satisfactory for me. Other IDEs make me very
confused. Really do not know which one to use.
I use WinXP sp2 for current development.
So far as I know, Eclipse + PyDev + PyDev Extension is perfect for
source code editing. Since I am really not sure how to use the debugger
module,
ion to get the name of a
function.
Kay Schluehr 写道:
> Sullivan WxPyQtKinter wrote:
>
> > So how
> > could I refer to the function object per se, in the body of the
> > function itself?
>
> Just use the name.
>
> def f():
> print f.__name__
>
> &
I have Google the whole thing and find another way for alternative
implementation of getting the function's name. But all they returns are
just strings. If I would like to refer to the function object in order
to call it recursively, what shall I do then?
--
http://mail.python.org/mailman/listinf
When debugging using 'print' statement, I usually want to print some
important values together with the function name as the context of the
values printed out. So my hope is that I could get the name of the
function.
Since every function object actually has a private __name__ attribute
that gives
I see. I once was a VB programmer. In VB, the current directory is
always set to where the module locates before it runs.
--
http://mail.python.org/mailman/listinfo/python-list
I see. I once was a VB programmer. In VB, the current directory is
always set to where the module locates before it runs.
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I mistyped the line. In the program it IS:
f=open("ticket.txt"), no '\' included.
--
http://mail.python.org/mailman/listinfo/python-list
I use python on Windows XP platform. I find that if I write a .py file
in a directory, such as windows desktop, in which a file named
'ticket.txt' is located:
f=open("ticket.txt")
print f.read()
In IDLE, this py file work all right. But if I launch python
interpretor in the command shell like th
I use python in Windows XP platform. I find that if I write a .py file
in a directory, such as windows desktop, in which a file named
'ticket.txt' is located:
f=open("\ticket.txt")
print f.read()
In IDLE, this py file work all right. But if I launch python
interpretor in the command shell like th
That lib can help.
But still, I have to code a lot using that lib. Maybe my program is
quite strange, far from common.
Thank you, after all~!
--
http://mail.python.org/mailman/listinfo/python-list
Sorry I am completely a green-hand in HTML. What is HTMLTemplate and
ElementTree? Would you please post some source code as an example?
Of course I would Google them to find out more.
Thank you so much.
--
http://mail.python.org/mailman/listinfo/python-list
Hi, everyone. Simply put, what I need most now is a python lib to
generate simple HTML.
I am now using XML to store my lab report records. I found python
really convinient to manipulate XML, so I want to make a small on-line
CGI program to help my colleagues to build their lab report records
into
Guess what would be the result of these functions:
>>>str.lower('ASFA')
>>>str.join(str(),['1','1','1'])
>>>str.join('a','b')
If you guess them correctly, please explain.
--
http://mail.python.org/mailman/listinfo/python-list
Yes, I checked out that I have already run "from string import *". So
the lower() means string.lower() function.
However, something else came out just now:
>>>instr='a'
>>>instr.join('b')
'b'
>>>instr.lower()
'A'
>>>instr
'a'
Both as the method of the type str, join never use the instr instance
ob
In python, these expression seems yields the same result:
inputstring='ABC'
print inputstring.lower()
print lower(inputstring)
print string.lower(inputstring)
result:
abc
abc
abc
Question:
Is the method lower() just a method for the inputstring instance( an
instrance object of a string class ob
I have gone over the shlex and cmd and so, but none of them are
satisfactory. However, I tried to program this this function on my own
and found it pretty easy.
Thank you so much for the suggestion, after all.
--
http://mail.python.org/mailman/listinfo/python-list
I do not know if there is any lib specially designed to process the
strings in scipt language.
for example:
I hope to process the string"print a,b,c,d,e "in the form"command
argumentlist" and return:
{'command'='print',
'argumentlist'=['a','b','c','d','e']}
Are there any lib to implement this?
Id
Thank you so much for help. It is my honor to get a reply from a
prestigious figure like you.
--
http://mail.python.org/mailman/listinfo/python-list
yes, I have tried Text Widget for quite some time. However, its speed
is far from satisfying.
When it holds more than 20,000 characters, it starts to response quite
slow. When you drag your mouse over some text to select, the selection
is usually done after 0.5second or so. My intent to use this w
In addiiton, I hope it directly support basic HTML grammar.
[EMAIL PROTECTED] 写道:
> Hi all
> I am using the standard python GUI Tkinter as my program's main
> interface. Although I know wxPython has some widget to support rich
> text widget, but I do not have time to shift to wx series. Does
45 matches
Mail list logo