I have a file that looks something like this: some text the grids are 3 x 3 more text matrix marker 1 1 3 2 4 7 4 2 9 1 1 new matrix 2 4 9 4 1 1 3 4 4 3 1 new matrix 3 3 7 2 1 1 3 4 2 3 2 .. the file continues, with several 3x3 matrices appearing in
I'm trying to create a loop in order to bring the user back to the beginning of the program. I can't get it to print "Welcome to the comparison function". The program will run, asking user for input 1 and 2 and then will print the answer of the
When i use trunc function in oracle and run the query in oracle developer i get only date value from the datetime field. for eg below query Select trunc(min(Transaction_Date)) as StartDate, trunc(Max(Transaction_Date)) as EndDate from table1 returns
My goal is to create a small sript that find all the result of a google search but in "raw". I don't speak english very well so i prefer to give an exemple to show you what i would like : I Type : elephant The script return www.elephant.com www.
I have a list which grows and shrinks in a for loop. The list looks like following :- . With every element inside list of list i want to associate it to a separate dictionary. list123 = [[1010,0101],[0111,1000]] In this case I want to create 4 dictio
I'm trying to install dlib-18.16 for python on my computer (running Mac OSX 10.10). I have boost python installed as well as X11, but I've been running into trouble when running ./compile_dlib_python_module.bat as instructed to after downloading the
I just completed the 3rd project Euler question which asks you to find the largest prime factor of a given number. I made a function which returns a list of all the prime factors for a number. For example, if you input 100 it would return [2.0, 5.0]
I'm trying to create a program that duplicates itself to another location and creates a batch file on the desktop. I can make it duplicate itself and I can create the batch file but I need some help with the paths. I can find the path that my program
I have a simple application that sends & receives messages, kombu, and uses Celery to task the message. Kombu alon, I can receive the message properly. when I send "Hello", kombu receives "Hello". But when I added the task, what ko
How can I print something like this: { username = admin email =
[email protected] id=42 } With only using a method = ['POST'] and without using render_template? PS: I already made it run with ['GET'] Here's my code: from flask import Flask, jsonify, re
I have a strange case for search and replace a string in text file using python. Input Data: I have a text file which looks similar as shown below. QA1,QBFLUX,1.0 many lines QA2,QBFLUX,1.0 many lines QA3,QBFLUX,1.0 many lines QA4,QBFLUX,1.0 many line
The program txt.py prints that takes in a directory as a command line parameter and prints all the files of a particular extension def printAll(path): for txtFile in glob.glob(path): print txtFile printAll(sys.argv[1]) In the command line I type in p
To understand *args and **kwargs I made some searchs about, when I fell on this question *args and **kwargs? The answer below the chosen answer caught my attention, which is this: class Foo(object): def __init__(self, value1, value2): # do something
I have a folder structure like this App --App --app.py --Docs --Tests --test_app.py In my test_app.py file, I have a line to import my app module. When I run py.test on the root folder, I get this error about no module named app. How should I configu
The code is as below: self.class_logg('http://example.com/api/?\ option=ajax&nologin=1&a=vmware_migrate_2&\ original_server_ip=%s&target_server_ip=%s&\ vmware_name=%s' % (self.ip, dest_node.ip, machine.name)) Because this string is so
How can I do the following in a more efficient python friendly way? first_team= re.sub("Northern", "N", first_team) first_team=re.sub("Western", "W", first_team) first_team=re.sub("Southern", "S"
In my Python script, I need to create a new file in a sub directory without changing directories, and I need to continually edit that file from the current directory. My code: os.mkdir(datetime+"-dst") for ip in open("list.txt"): with
Hi heroku python people, I want my heroku app to access shared private libraries in my github account. So I would like to have a requirements.txt file that looks like this ... # requirements.txt requests==1.2.2 -e git+ssh://
[email protected]/jtushman/di
Hi I'm trying to write a small helper function to save an object to a csv under its own name. I'm working with arrays of data and this is intended to be a workaround to help visualise the array easily to help with editing it. The challenge I'm facing
I've been supplied with a zipped file containing multiple individual streams of compressed XML. The compressed file is 833 mb. If I try to decompress it as a single object, I only get the first stream (about 19 kb). I've modified the following code s
I'm trying to learn python and I was trying to write something simple. I am developing under Pydev (Eclipse) using OS X 10.8. I installed python 3.2 using the 64bits .dmg installer. I configured the Python interpreter successfully (or I think so, as
I need to navigate to an html element of a particular type. However, there are many such elements of that type on the page, with many different classes. I need one which does not have any class attribute. Should I look for one with class == '', or is
I decision trees implemented in Python as dictionaries. Example: sampletree = {'spl':'foo', 'go_r':{'cut':150} , 'l':{'val':100}, 'r':{'val':200}} I have a recursive function prints the tree: def TREE_PRINT(tree, indent=''): #is this a leaf node? if
Possible Duplicate: How can I hide the console window in a PyQt app running on Windows? I've made a simple app that opens a QWebView but in addition to the app window Windows console window is opened to. What could be the reason for this? import sys
I would like to know what is the best import strategy within django reusable applications. Say I have an application called usefulapp. Inside my app, I will need to access, say, the models. Should I use an explicit import as: import usefulapp.models
This code works: from pyparsing import * zipRE = "\d{5}(?:[-\s]\d{4})?" fooRE = "^\!\s+.*" zipcode = Regex( zipRE ) foo = Regex( fooRE ) query = ( zipcode | foo ) tests = [ "80517", "C6H5OH", "90001-3234",
I have a trac wiki page I'd like to update automatically on a regular basis (say, once an hour) with data fetched by a script. I can get the script to generate the wiki markup. How would you then upload that to the trac page? I want to replace the wh
Here's my problem: class City(Model): name = StringProperty() class Author(Model): name = StringProperty() city = ReferenceProperty(City) class Post(Model): author = ReferenceProperty(Author) content = StringProperty() The code isn't important... its
How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?Here is how I did : First you need to co
I have the following Python code using Genshi (simplified): with open(pathToHTMLFile, 'r') as f: template = MarkupTemplate(f.read()) finalPage = template.generate().render('html', doctype = 'html') The source HTML file contains entities such as ©, ™