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
3 views
Why do Sqlalchemy Session.close doesn't log “rollback”?
# I've set echo=True when doing create_engine, so I can see all the sql stmt
session = DBSession()
session.add(somemodel)
#
try:
session.flush()
raise Exception()
session.commit()
except ...
0
votes
0answers
6 views
Pycharm : how-to launch for a standard terminal (to solve an issue with curses)
I'm facing a weird problem.
Using Pycharm (please do not troll about this fact), I'm trying to launch a short app that uses ncurses to render some things on my term.
While I can launch the project in ...
0
votes
1answer
12 views
Python: function to compare lists - no __cmp__
I have a list of objects that I want to sort. Each object has an id which is a list of strings.
So I defined:
class MyObject(object):
...
def __cmp__(self, other):
return ...
0
votes
2answers
15 views
Save data from separate columns in a file into a variable in Python 2.7
So I have a sample data in a file, which is of the arrangement:
u v w p
100 200 300 400
101 201 301 401
102 202 302 402
103 203 303 403
104 204 304 404
105 205 305 405
106 206 306 ...
-1
votes
1answer
11 views
How to add multiple paragraphs to a variable in Javascript dynamically? Actually I'm getting those paragraphs from the view
document.getElementById('id_comment_133').value = "Great job using the customer’s name during the initial greeting! This not only showed good communication between the sales team members, but also ...
0
votes
0answers
10 views
Speeding up reading the url response in python
I have a piece of code that queries a server that returns a big json object(elasticsearch, BTW),
It takes a lot of time to read the results. parsing the json object is very fast.
tic = time.time()
...
-1
votes
0answers
17 views
python: Merge List list of lists if a reverse complement is a sub list of another
Suppose that I have a list of lists. what is the fastest way to compare if part of the reverse complement(reverse and each number * -1) is a sub list of another list of lists within the same list. If ...
0
votes
2answers
15 views
How to access a value from this JSON object returned from the google books API python?
I am accessing the Google Books API from a python script and I need to fetch a particular value in the JSON object I get. For instance if you follow this:
...
0
votes
2answers
12 views
Python Disk Imaging
Trying to make a script for disk imaging (such as .dd format) in python. Originally started as a project to get another hex debugger and kinda got more interested in trying to get raw data from the ...
1
vote
2answers
40 views
Parsing multiple lines in Python
I'm currently learning Python and I need to write a program which determines the word which appears the most times in a poem. Problem which is troubling me is about parsing a lines of a poem into a ...
0
votes
1answer
31 views
python how to access a variable, whose name in another variable
data.name='Some Name'
col1='name'
data.col1 ???
how to access data using only var col1,
like data.col1 or some thing
Simple the variable name is stored in another variable, actually from a ...
0
votes
1answer
15 views
Implementation of Levenshtein on database records using python
How do I implement levenshtein distance on records in a database table using python? I know how to connect python with database, coding in python may not be problem, and I also have the records in a ...
0
votes
0answers
18 views
Django tutorial - how to run on choice_set
I completed Django tutorial and now want to add ajax into it, so the votes will remain in the same page.
So my question is how can I run a for loop on the p.choice_set in my view.py so I can send the ...
-1
votes
4answers
32 views
remove lines with first column with 6 digits in a csv files
I got a csv file like this
"5478",a,56.40,-0.40 ,55.50,57.50,55.30,56.74,"862,971","48,962,460","695",56.40,56.60,"127,474,332",56.40,60.30,52.50
"5480",b,21.90,-0.25 ...
0
votes
2answers
25 views
Property method without class
I have a next code
global_variable = 1
@property
def method():
# Some magic, for example
# incrementing global variable
global global_variable
global_variable += 1
return ...