Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
0answers
10 views
Django-How to combine two object set & remove the common objects in these two sets
i am now trying to implement a search function in django and is using the filter functions. After looking through the functions I could call to an object set, I am confused on how I am going to ...
0
votes
0answers
3 views
getting parent elements in xslt with python's lxml library
I'm new to lxml and xslt and trying to do the following - this is my xml:
<root>
<header>
<h1>foo</h1>
</header>
<product>
<a>something1</a>
...
0
votes
0answers
8 views
How to accept user input without waiting in Python
I'm creating an IRC bot and I want to be able to constantly receive from my buffer, but at the same time if I type a command into the console I want it to be readily accepted. So far I have a infinite ...
1
vote
0answers
16 views
String format alignment
I'm baffled on how to solve this formatting issue. I suspect it's because there are two variables present instead of one which in turn throws it all off.
This is my output currently..
Bin Range ...
0
votes
0answers
10 views
Disconnect UDP socket in python?
I need to 'disconnect' a UDP socket in python(and not close it!).
Is it possible to do the equivalent of:
int disconnect_udp_sock(int fd)
{
struct sockaddr_in sin;
memset((char ...
0
votes
0answers
11 views
GIT/Heroku sensitive info
I have a django project deployed in Heroku. It uses python-instragram.
I have a 'client secret' from an instragram client that I have.
I use git/github for version control.
This client_secret is ...
0
votes
1answer
14 views
How can I print instance of class that has user defined attributes?
I'm trying to figure out how to print out the instance of a class with user defined attributes in Python 3.
Here is the code I have:
class Attendie:
def __init__(self, fname, lname, company, ...
2
votes
3answers
38 views
splitting a dot delimited string into words but with a special case
Not sure if there is an easy way to split the following string:
'school.department.classes[cost=15.00].name'
Into this:
['school', 'department', 'classes[cost=15.00]', 'name']
Note: I want to ...
1
vote
4answers
65 views
How do we use comprehension here
I have the following multi-loop situation:
notify=dict()
for m in messages:
fields=list()
for g in groups:
fields.append(func(g,m))
notify[m.name]=fields
return notify
Is there ...
-1
votes
0answers
16 views
How to write this server-client program in python
I know almost nothing on multi-thread and client-server programming. I need a server-client program as the followings. Could anyone please kind me how to write it:
Multiple clients vs. one server.
...
-1
votes
2answers
12 views
Print Only Last Number From Continued Fraction In Python
I have a continued fraction calculator in python. The last number of the sequence represents that that number repeats forever.
var = 1
while var == 1 :
print "Enter a number:"
q=h=input()**.5
...
0
votes
1answer
16 views
filter function- how to pass foreign key objects attribute as Keyword
I am currently implementing a searching function in Django and plan to use the filter related functions. After reading some doc on django docs, it seems to me that keyword can just be varchar type, in ...
2
votes
3answers
29 views
Using regex for mutliple lines
What is the best way of extracting expressions for the following lines using regex:
Sigma 0.10 index = $5.00
beta .05=$25.00
.35 index (or $12.5)
Gamma 0.07
In any of the case, I want to extract ...
1
vote
0answers
15 views
How to deal with combination of text and numeric features?
Looking at Kaggel's Job Salary Prediction, I see numeric features (like Category) and textual ones (like FullDescription).
How do I go about training on such data? I thought about vectorizing the ...
1
vote
4answers
39 views
Python convert a paritcular string to dict
The format of string is like "a:1 b:2 c:x d:2.13e-5", is there some way to convert it to python dict quickly and simply?