I'm trying to use python to determine if one (small) image is within another (large) image.
Any suggestions before I take myself completely down the wrong path?
Hi,
What is Python's equivalent of "public static void main(String[] args) { ... }"? I remember having used it in the past and then forgot.
What I'm basically trying to remember is a function which I think included some underscores (__)...
thx
it works fine on 64 bit machines but for some reason will not work on python 2.4.3 on a 32-bit instance.
i get the error
'utf8' codec can't decode bytes in position 76-79: invalid data
for the code
try:
str(sourceresult.sourcename).encode('utf8','replace')
except:
raise Exception( repr(sourceresult.sourcename ) )
it returns 'kazamidori blog\xf9'
i have modified my site.py file to make UTF8 the default encoding, but still doesnt seem to be working.
Hi,
I want to find the most used colour in an image using python. for example detect the colour of the object in the following image
http://www.shopcrazy.com.ph/wp-content/images/2007/02/shiny-bags-01.jpg.
how to detect the base colour from the RGB codes(example - red in the above image).
Hi there,
I have a piece of text that gets handed to me like:
here is line one\n\nhere is line two\n\nhere is line three
What I would like to do is break this string up into three separate variables.
I'm not quite sure how one would go about accomplishing this in python.
Thanks for any help,
jml
I was working with Python with a Linux terminal screen. When I typed:
help(somefunction)
It printed the appropriate output, but then my screen was stuck, and at the bottom of the terminal was "(end)".
How do I get unstuck? Thanks in advance.
I want to send a datetime.datetime object in serialized form from Python using JSON and de-serialize in JavaScript using JSON. What is the best way to do this?
Hi! I am interested in saving and load objects using the pickle module as you can read in a question I asked before:
Python: Errors saving and loading objects with pickle module
Someone commment:
1, In an other way: the error is raise because pickle wanted to load an instance of the class Fruits and search for the class definition where it was defined, but it didn't find it so it raise the error
Now I want to save and load a class definition in order to solve the problem I describe in the question mentioned before.
Thank you so much!
Python is filled with little neat shortcuts.
For example:
self.data = map(lambda x: list(x), data)
and (although not so pretty)
tuple(t[0] for t in self.result if t[0] != 'mysql' and t[0] != 'information_schema')
among countless others.
In the irc channel, they said "too many to know them all".
I think we should list some here, as i love using these shortcuts to shorten & refctor my code. I'm sure this would benefit many.
I have a few questions about python
I've seen many pages like these on Google
http://mail.google.com/support/bin/answer.py?answer=6583
https://www.google.com/adsense/support/bin/topic.py?topic=13488
...that have .py extensions. 1: Are pages like these built on pure python code, but printing out html like print "<div etc..." or like the typical asp,jsp,php type of pages with html pages and embedded python code like:
<html>
<% some python code %>
</html>
2: What is python mainly used for making? windows apps or web or .. ?
3: Are ruby and perl also similar to python?
Is there a general convention about exposing members in Python classes? I know that this is a case of "it depends", but maybe there is a rule of thumb.
Private member:
class Node:
def __init__(self):
self.__childs = []
def add_childs(self, *args):
self.__childs += args
node = Node()
node.add_childs("one", "two")
Public member:
class Node2:
def __init__(self):
self.childs = []
node2 = Node2()
node2.childs += "one", "two"
Hello everyone,
How can I get the file name and line number in python script.
Exactly the file information we get from an exception traceback. In this case without raising an exception.
I am building a python application to pull data from a website. The application has to authenticate(HTTPS/SSL) with a CAC card and pin in order to make requests.
Am I correct in my assumptions that you can't retrieve the private key from a CAC card, and am therefore stuck using a PKCS #11 Wrapper like PyKCS?
Any tips or resources for going about this?
This whole topic is way out of my depth, so forgive my imprecise question, but I have two computers both connected to one LAN.
What I want is to be able to communicate one string between the two, by running a python script on the first (the host) where the string will originate, and a second on the client computer to retrieve the string.
What is the most efficient way for an inexperienced programmer like me to achieve this?
Hi,
I need to construct an if statement from the data coming from the client as below:
conditions: condition1, condition2, condition3, condition4
logical operators: lo1, lo2, lo3 (Possible values: "and" "or")
Eg.
if condition1 lo1 condition2 lo3 condition4:
# Do something
I can think of eval/exec but not sure how safe they are! Any better approach or alternative?
Appreciate your responses :)
PS: Client-side: Flex, Server-side: Python, over internet
Thanks
What is the most effective and compatible automatic Python obfuscator? What are your experiences with using each?
And before anyone asks why I am obfuscating -- I am doing it simply because I can. Thanks.
I have issue where i want to create Dynamic function which will do some calculation based to values retrieved from database, i am clear with my internal calculation but question in how to create dynamic class:
My Structure is something like this :
class xyz:
def Project():
start = 2011-01-03
def Phase1():
effort = '2d'
def Phase2():
effort = '3d'
def Phase3():
effort = '4d'
Now want to generate those all PhaseX() function dynamically so can any one suggest me
how to achieve such thing using Python Code
Waiting for Positive reply
Regards
Thank You
I write a python class which makes asynchronous method calls using D-Bus. When my reply_handler is called, it stores data in list. This list can be used by another class methods at the same time. Is it safe or I can use only synchronized data structures like Queue class?
What are the differences between these built-in Python data types: list, sequence and slice? As I see it, all three essentially represent what C++ and Java call array.
Hi, I'm developing C extensions from python ad I obtain some segfaults (inevitable during the development...).
I'm searching a way to display at which line of code the segfault happens (an idea is like tracing every single line of code), how I can do that?
Hi everyone,
I have two python cgi pages (index, display), what i need to do is calculate time frame between the execution.
Work flow:
Index.py (submit)
After submit it redirect to display.py page
display.py page has got class with execute(),display() &init_main() functions
In init_main() i have created class object which access to above functions
I need to calculate time interval between the submit (index.py) to execute() end, so i can show user how much time does different weighted file takes on real time.
Hoping to see your suggestions
Thanks
I want to run a cmd exe using a python script.
I have the following code:
def run_command(command):
p = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return p.communicate()
then i use:
run_command(r"C:\Users\user\Desktop\application\uploader.exe")
this returns the option menu where i need to specify additional parameter for the cmd exe to run. So i pass additional parameters for the cmd exe to run.
How do i accomplish this. I've looked at subprocess.communicate but i was unable to understand it
I'm trying to write a function named median that takes a list as an input and returns the median value of the list.
I'm working with Python 2.7.2
The list can be of any size and the numbers are not guaranteed to be in any particular order.
If the list contains an even number of elements, the function should return the average of the middle two.
This is the code I'm starting with:
def median(list):
print(median([7,12,3,1,6,9]))