I'm new to python and I'm not sure how to pass data between objects. Below is a tabbed program using python and wxwidgets. How would I be able to access the maintxt instance from the GetText method since their in different classes?
Thanks.
........
#!/usr/bin/env python
import wx
class PageText(wx.Panel):
def __init__(self, pare...
I've got a list like
[(1, 2), (1, 8), (2, 3), (2, 7), (2, 8), (2, 9), (3, 1), (3, 2), (3, 5), (3, 6), (3, 7), (3, 7), (3, 9)]
I want to make it looks like
[('1',' ', '2', '8'), ('2', ' ', '3', '7', '8', '9'), ('3', " ", '2', '5', '6', '7', '7', '9')]
How can I code this loop? Really tried times, and nothing came up. Please help~~
...
i want to find a substring 's index postion,but the substring is long and hard to expression(multiline,& even you need escape for it ) so i want to use regex to match them,and return the substring's index,
the function like str.find or str.rfind ,
is there some package help for this?
...
I want to know what's the use of built-in function slice and how can I use it,
the direct way of pythonic slicing I know l1[start:stop:step], I want to know if I have object of slice then howto?
...
I'm new to Python, and using Google App Engine, which is currently running only Python 2.5. Are there any built-in ways of doing an ordered dictionary, or do I have to implement something custom?
...
The question i'm working on asks me to "write an expression whose value is the concatenation of the three str values associated with name1 , name2 , and name3" , separated by commas."
"So if name1 , name2 , and name3 , were (respectively) "Neville", "Dean", and "Seamus", your expression's value would be "Neville,Dean,Seamus". "
T...
I've seen people use monkey-patching to set options on a module, for example:
import mymodule
mymodule.default_img = "/my/file.png"
mymodule.view_default_img()
And Django, for example, has settings.py for the entire Django app, and it always grates on me a little.
What are the other ways to manage...
Is there a convenient way to get a more detailed stack trace on a Python exception? I'm hoping to find a wrapper utility/module or some other way to get a bit more info from the stack trace without having to actually modify the Python script that generates it. I'd like to be able to use this when running unit tests, or doctests, or whe...
rec_fn = lambda: 10==11 or rec_fn()
rec_fn()
I am new to Python and trying to understand how lambda expressions work. Can somebody explain how this recursion is working? I am able to understand that 10==11 will be 'false' and that's how rec_fn will be called again and again recursively.
But what I am not able to get is this seemingly ...
.. the difference between the = and the == signs in Python? i.e provide examples when each is used so there's no confusion between the two?
...
Possible Duplicate:
python beautifulsoup related problem
hello All.
i have some problem to extract some data from html source.
following is sniffit of my html source code, and i want to extract string value in every
following
<td class="gamedate">10/12 00:59</b></td>
<td class="gametype">오버언더</b></td>
<td class="legue"...
Hello,
try:
for i in list:
try:
#python code...
cexcept Exception,e:
#error handler
except Exception,e:
error handler
If in the nested try/except it errors out, does the loop continue running?
...
We've just started to kick the tires pyparsing and like it so far, but we've been unable to get it to help us parse fractional number strings to turn them into numeric data types.
For example, if a column value in a database table contained the string:
1 1/2
We'd like some way to convert it into the numeric python equivalent:
1.5
We...
Hi,
I now primarily write in python, however I am looking for a language that is more thread friendly (not JAVA,C#,C or C++).
Python's threads are good when they are IO bound but it's coming up short when I am doing something CPU intensive.
Any ideas?
Thanks,
James
...
The question i'm working on asks "Given the variables name1 and name2 , write a fragment of code that assigns the larger of their associated values to first" ('first' in bold letters)
(NOTE: "larger" here means alphabetically larger, not "longer". Thus, "mouse" is larger than "elephant" because "mouse" comes later in the dictionary ...
i have a texaarea which put regular expression to match html,so it's senstive to \r\n & \n,
and i don't know textarea how's doing with this,
when i write a wring regular expression with muliple lines,put these string to the textarea,then send to the server process match procedure,it will not work,i think the main reason is \r\n \n symbo...
I'm not sure if this is just me (or whether this is the appropriate section/question) but is anyone else finding docs.python.org and PyPi to be down?
If so is there a newer version or a similar working site?
Thanks, Fergus
...
Hi, I've got an issue when installing Django.
The official guide says open cmd with administrator privileges and run "setup.py install"
I did this but then the system default python editor came out, I don't know how to do anymore, please help me~
...
i have been asked to write a function which should be called in this way
foo("Hello")
This function also has to return values in this way:
[Hello( user = 'me', answer = 'no', condition = 'good'),
Hello( user = 'you', answer = 'yes', condition = 'bad'),
]
the task has clearly asked to return string values. can anyone understand the...
so here's the setting:
The whole site is working fine if I remove the application (whose name
is myapp) in the INSTALLED_APPS section in the settings file I added WSGIPythonHome in apache2.conf
I can successfully access the apps via the the interactive python shell in Django (python manage.py shell). I can create, update and delete...