text stringlengths 226 34.5k |
|---|
Splitting Code in different Files - Python / App Engine
Question: I have multiple classes and everything is in a single main.py file which is
getting really messy...
I'm new to Python however I've taken a couple of courses now and I'm getting
quite good but in none of the lessons was a reference on how to do this...
... |
How do I get rid of spaces in the 'message' when sending SMS via Kannel
Question: I've setup Kannel in Ubuntu using a USB Modem and I can send SMS via the
browser using the URL as seen below
localhost:13013/cgi-bin/sendsms?username=kannel&password=kannel&to=+254781923855&text='Kid got swag'
In pyth... |
Using signals concept to do events
Question: This is i am doing to send mail once a record is updated in the database.I had
defined the receivers in separate file called listeners.py to receive the
signals.
signals.py
import django.dispatch
send_email_to = django.dispatch.Signal()
listene... |
Finding minimum value of word from a lot of files in python?
Question: I have 1000 `.txt` files on which I run this code. What I have to do is find
the largest value of ENSG in the files and delete other values of ENSG which
are less than the largest one. Then I have to find the minimum value from the
same text file by... |
IF statement error new variable input python
Question: The problem here is that I just cant get python to check if Currency1 is in
string, and if its not then print that there is an error,but if Currency1 IS
in string then move on and ask the user to input Currency2, and then check it
again.
Answer: You were actually... |
GUI's in Python
Question: The way I have it right now, I'm working with Easygui, but I don't really like
how Easygui looks on my Windows 7 system. I was wondering if there is any way
to use the actual Windows GUI's (WinAPI, is it called?)
If this is possible, where can I find a tutorial on how to use it? (Ex putting
i... |
Python - read in a previously 'list' variable from file
Question: I previously created a `list` and saved it to a file 'mylist.txt'. However,
when I read it in it's a string, meaning I can't access each element as I
like. I have been trying and searching for ways to fix this, but to no avail.
In the text document, the... |
Interact with long running python process
Question: I have a long running python process running headless on a raspberrypi
(controlling a garden) like so:
from time import sleep
def run_garden():
while 1:
/* do work */
sleep(60)
if __name__ == "__main__":... |
How do I use mlabwrap to call a matlab function with cell arguments from python?
Question: Well, I was proud of myself that I got mlabwrap installed properly, but now I
cannot get it to work with matlab cells. In python, lists are analogous to
cells, so I figured I would input a list and mlabwrap would convert it to a
... |
Setup wizard like script in Python
Question: I'm writing a simple _setup wizard_ like script in Python. Basically it
prompts the user to enter some values and answer some yes/no questions. Based
on the user input the script will then make directories, create and initialize
config files, create symlinks, set permissions... |
Tkinter problems with GUI when entering while loop
Question: I have a simple GUI which run various scripts from another python file,
everything works fine until the GUI is running a function which includes a
while loop, at which point the GUI seems to crash and become in-active. Does
anybody have any ideas as to how th... |
os.system for submitting command
Question: I am using os.system to submit a command to the system.
I.e.,
import os
os.system(my_cmd)
But I was wondering how could I obtain the output, i.e., let us say i am in
the bash and I type in my cmd, I'd get an output of this form:
Job <57... |
Remove near-duplicate elements in Python list while preserving variables
Question: I have a list that contains near-duplicate elements, with the exception of a
number that identifies the element. I want to remove all duplicates while
preserving the number of the first element containing a duplicate.
For example, I wan... |
creat a list from sql query output with the attribute name instead of the index using python
Question: I have this code.
cursor.execute("select id, name from client")
clientids= cursor.fetchall()
clientidList = []
for clientid in clientids:
#I can do that
clientidList.append(c... |
Boolean Variable in TKinter 8.5
Question: I did this inside the python shell:
from Tkinter import *
v = BooleanVar()
But I got the following error:
Traceback (most recent call last):
File "<pyshell#52>", line 1, in <module>
v = BooleanVar()
File "/usr/lib... |
Python advice using delays with tkinter
Question: I have created GUI using tkinter, which will run on the RaspberryPi and will
perform various actions such as lighting LEDs. The problem I have is toggling
an LED on and off using the root.after scheduling as if I use time.sleep(),
the GUI will freeze while in this sleep... |
subprocess.popen pid change
Question: I have a script in which I use subprocess.Popen to start an external program
and process.kill() to kill it pretty much as soon as it's started. I've been
getting Windows Error [5] (Access Denied) every time the script tries to kill
it. I've realized that the pid of the program is a... |
Limit count of threads for python script
Question: I have a python 2.7 script on a CentOS linux server which had a bug starting
new threads until I could not login to the server anymore.
Is there a way to tell the python runtime not to create/start/use more than 50
threads (and to throw exceptions instead or kill the ... |
Fill in form using Spynner in Python
Question: I am trying to fill in my user name and password on this site:
<https://www.imleagues.com/Login.aspx>
From there, I want to submit it and log in. I have been able to click the
login button, but it tells me I have incorrect username and password. How
should I go about fill... |
Plone 3.1.2 - TypeError in ATDocument.getText() method
Question: My task is to unload content from a Plone 3.1.2 website and load information
about the content to an SQL database + file system
I've recreated the website, got access to ZODB and recreated object and folder
structure. I am also able to read properties of... |
'lxml.etree._Element' object has no attribute 'write' ??? (PYTHON)
Question:
from lxml import etree
root = etree.Element('root1')
element = etree.SubElement(root, 'element1')
root.write( 'xmltree.xml' )
Error:
AttributeError: 'lxml.etree._Element' object has no attribute 'wr... |
Multiprocessing python-server creates too many temp-directories
Question: I'm trying to implement a server in python3.3 that has a separate thread
preloaded to do all the processing for the incoming connections.
from multiprocessing import Process, Pipe, Queue
from multiprocessing.reduction import re... |
ImportError: No module named opencv.cv
Question: I installed opencv on Linux Mint using:
sudo apt-get install python-opencv
When I attempt to import the opencv module using:
from opencv.cv import *
I receive the error:
from opencv.cv import *
ImportError: No ... |
Is there a standard solution for Gauss elimination in Python?
Question: Is there somewhere in the cosmos of `scipy/numpy/...` a standard method for
Gauss-elimination of a matrix?
One finds many snippets via google, but I would prefer to use "trusted"
modules if possible.
Answer: I finally found, that it can be done ... |
python twisted man-in-the-middle implementation
Question: What I need is a sort of man-in-the-middle implementation: I need a server who
receives connections from clients (binary data with different lengths) and
forwards the stream to a server it connects to (acting as a client), and then
sends the data back from the s... |
Get header values of reply using pycurl
Question: I would like to know some ways to capture and access the header information of
the reply when making a request with PyCurl:
c = pycurl.Curl()
c.setopt(c.URL,'MY_URL')
c.setopt(c.COOKIEFILE,'cookies')
c.setopt(c.COOKIE,'cookies')
c.setopt(... |
Python: how to have mutually exclusive groups in subparser using argparse?
Question: I am writing a program like:
import argparse
def task1(args):
print "running task 1"
def task2(args):
print "running task 2"
if __name__=="__main__":
parser=argpars... |
"Flattening" a list of dictionaries
Question: So my aim is to go from:
fruitColourMapping = [{'apple': 'red'}, {'banana': 'yellow'}]
to
finalMap = {'apple': 'red', 'banana': 'yellow'}
A way I got is:
from itertools import chain
fruits = list(chain.from_iter... |
How to aggregate data into dictionary (or some other database) in python?
Question: I am wondering if the following would be a good method in python to aggregate
data that needs to be queried in another function by multiple keys or if I
would have better performance using SQLite to read and write data.
For example som... |
Python 3.3 can't seem to find the decoder module in pocketsphinx library
Question: I am getting the error **AttributeError: 'module' object has no attribute
'Decoder'.** I am using the following code. Because there was no setup.py file
included I moved the dlls and libraries into their respective folders in the
python3... |
Python regex find two groups
Question:
>>> text = '<a data-lecture-id="47"\n data-modal-iframe="https://class.coursera.org/neuralnets-2012-001/lecture/view?lecture_id=47"\n href="https://class.coursera.org/neuralnets-2012-001/lecture/47"\n data-modal=".course-modal-frame"\n rel="lecture-link"\n class="le... |
Python: pass function as parameter, with options to be set
Question: In Python, I need to call many very similar functions on the **same input
arguments** `sampleA` and `sampleB` . The only thing is that some of these
functions require an **option** to be set, and some don't. For example:
import scipy.st... |
How to use beaker without install it?
Question: Beaker is not a part of python standard library, and **I want to make my
application has no dependencies rather than the python standard library
itself**. To accomplish this, I download beaker and extract as a sub-package
of my application.
Then, I use this:
... |
Analysis of images using PIL in Python
Question: I found this code:
import PIL
from PIL import Image
from matplotlib import pyplot as plt
im = Image.open('./color_gradient.png')
w, h = im.size
colors = im.getcolors(w*h)
def hexencode(rgb):
r=rgb[0]
g=rgb[1]... |
Most efficient way to "nibble" the first line of text from a text document then resave it in python
Question: I have a text document that I would like to repeatedly remove the first line
of text from every 30 seconds or so.
I have already written (or more accurately copied) the code for the python
resettable timer obj... |
handling telnetlib timeout error in python
Question: I am trying to write a python script to establish a telnet connection (using
telnetlib) to a range of hosts:
for i in range(len(HOST)):
print "scanning " + HOST[i] + " ...\n"
tn = telnetlib.Telnet(HOST[i],23,3)
The problem is when... |
How to programmatically measure the elements' sizes in HTML source code using python?
Question: I'm doing webpage layout analysis in python. A fundamental task is to
programmatically measure the elements' sizes given HTML source codes, so that
we could obtain statistical data of content/ad ratio, ad block position, ad
... |
python string match time complexity
Question: I need help for this question. I think the time complexity is O(n), but my
friend insists that this is O(n^2). one of reason is because of `fn =
fn[index+1 ::]`
#filename: string_expression_matcher.cc
#string: stxpm.c
#should return
... |
How to change value of the variable in one python script from another python script
Question: I have to files python1 and python2.
Python2.py has code something like this:
import sys
variable1=value1
variable2=value2
#and some python code from here on
The python1 script should take the... |
List: Counting and Deleting
Question: Given a list, for example List=["X","X","O","O",'O','O'], how would I count
how many "X"'s there are in a list, and then subtract that many "O"s from the
list. The List will always put all X's first and all O's last. I thought I
could do something like...
List=["X","... |
Inserting data into MySQL database from Python
Question: I have 2 tables TBL1 and TBL2. TBL1 has 3 columns date, id, nSql. TBL2 has 3
columns date, custId, userId. I have 17 rows in TBL1 with id 1 to 17 (which
will grow later). Each nSql has a SQL query in it. For example nSql for id=1
is: "select date, pId as custId, ... |
How to extract data from the file by using regular expression in python?
Question: I have a file, in that emailid, phoneno and my dateofbirth is there. In python
by using regular expression, how to find the 3 fields one by one? The desired
output looks like
Emailid: x@gmail.com
Phoneno: 1234567890
... |
start python pdb with multiple arguments?
Question: I was wondering if there is a way to start pdb with multiple arguments.
Currently I know I can do this:
python -m pdb script.py
and then manually setup break points, with:
(Pdb) break
(Pdb) break 2
Breakpoint 1 at /home/oz... |
Accessing YAML data in Python
Question: I have a YAML file that parses into an object, e.g.:
{'name': [{'proj_directory': '/directory/'},
{'categories': [{'quick': [{'directory': 'quick'},
{'description': None},
... |
python can't print unpacked floats from network
Question: I try to get floats from an UDP datagram and to print them to verify:
import socket
from struct import *
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket.bind( ('127.0.0.1', 2416) )
msg = bytearray( 4*1024 )
... |
Python Namedtuple Indexing Instance
Question: So Here is my code for my lab coding project that I am currently working on:
from collections import namedtuple
Restaurant = namedtuple('Restaurant', 'name cuisine phone dish price')
# Restaurant attributes: name, kind of food served, phone numbe... |
What is a way to convert text to a string in Python 3.3.0
Question: Hi so i'm having a hard time getting Text from my program on Python to convert
to a string so i can write it to a file without it just writing numbers in the
file. i put this code :
from tkinter import *
a = Tk()
a.title("i ... |
Why does HTTP POST request body need to be JSON enconded in Python?
Question: I ran into this issue when playing around with an external API. I was sending
my body data as a dictionary straight into the request and was getting 400
errors:
data = {
"someParamRange": {
"to": 1000,
"f... |
Is pickle not compatible with twisted?
Question: I have made 2 application: The client extract data from a sql server (10k
lines), and send every line pickled to a "collector" server via socket. The
server uses twisted (this is mandatory) and receive every line, unpikle it and
store the data in another sql server.
Eve... |
Binning frequency distribution in Python
Question: I have data in the two lists _value_ and _freq_ like this:
value freq
1 2
2 1
3 3
6 2
7 3
8 3
....
and I want the output to be
bin freq
1-3 6
4-6 2
7-9 6
... |
Python matplotlib and libpng Incompatibility issue
Question: I'm really suffering from this problem for so long.
Originally, after plotting something with matplotlib, I could easily save the
image.
However, after installing scipy, I couldn't save my image anymore.
(I installed matplot and scipy by using pip.)
I... |
How to make a window that occupies the full screen without maximising?
Question: I'm writing in python using Qt
I want to create the application window (with decorations) to occupy the full
screen size. Currently this is the code I have:
avGeom = QtGui.QDesktopWidget().availableGeometry()
self.setGe... |
python fdb, trying to connect to an external firebird 1.5 super server
Question: I'm trying to connect to a Firebird 1.5 database that is located on a server,
from my local machine with Python fdb libary. but I'm having no luck.
the server is windows 2008 server R1 running Firebird 1.5.6 as a service. It
also has a S... |
rpy2 module not working in Python3.2
Question: I am trying to import the rpy2 (version2.3.4) library into Python
(version3.2.3) on a Ubuntu 12.10 machine. The rpy2 documentation says that
rpy2 works under all Python 3 versions and I am also finding other topics
related to rpy2 and Python3.2 which show that these versio... |
What's wrong with my filter query to figure out if a key is a member of a list(db.key) property?
Question: I'm having trouble retrieving a filtered list from google app engine datastore
(using python for server side). My data entity is defined as the following
class Course_Table(db.Model):
course... |
PATH environment variable in python
Question: I'm using OS X 10.8.3.
If you open a terminal,
echo $PATH
/usr/local/bin is there, also if you run it via sh or bash
however the python code output of:
import os
print os.environ.copy()
lacks the /usr/local/bin path
Can anyon... |
Sorting multidimensional JSON objects in python
Question: I have an object as such and want to sort it by time (line first, point
second) in each dimension (simplified json):
[{
"type":"point"
},
{
"type":"line",
"children": [
{
"type":"point"
... |
Returning a value from TkInter Slider + making slider horizontal with classes
Question: I am having a problem printing the value of a slider bar. I created a button
below the slider to do so, but it prints before it is pressed and doesn't
print when pressed.
I also have the problem of making teh slider horizontal. I k... |
Python: Search for and delete nested lists of dictionaries
Question: I have a tree of nested lists and dictionaries that I need to recursively go
through and remove entire dictionaries that match specific criteria. For
instance, I need to remove all dictionaries with the 'type' of 'Folder' that
have no children (or an ... |
Using Sage Math library within Python
Question: I am trying to make a visualization of a graph using Sage. I need to make the
visualization exactly as I am writing the Python code.
I have downloaded and installed the Sage for Ubuntu and Sage Notebook is
working perfectly. But I want to take user input from Tkinter and... |
Python: Using pdb with Flask application
Question: I'm using Flask 0.9 with Python 2.7.1 within a virtualenv, and starting my app
with `foreman start`
In other apps I've built when I add the following line to my app:
import pdb; pdb.set_trace()
then reload the browser window, my terminal window di... |
Installing QuantLib python SWIG module on Google app engine
Question: I am new to GAE. I wish to use the QuantLib python library (SWIG) as a module
inside google app engine. I was following this blog post to set up QuantLib-
SWIG on Ubuntu. <http://blog.quantess.net/2012/09/26/quantlib-get-it-working-
on-ubuntu/>
I ha... |
using python logging in multiple modules
Question: I have a small python project that has the following structure -
Project
-- pkg01
-- test01.py
-- pkg02
-- test02.py
-- logging.conf
I plan to use the default logging module to print messages to stdout and a log
file. ... |
why is the code returning IndexError error in python when the synsets of the word exists
Question: I do not understand why I am getting this error. Please help
>>> mylist = []
>>> file1 = open("medDict.txt", "r")
>>> for line in file1:
from nltk.corpus import wordnet
print line
... |
SQLAlchemy ValueError for slash in password for create_engine()
Question: Fairly simple-looking problem: my Python script is attempting to create a
SQLAlchemy database connection. The password contains a forward slash:
engineString = 'postgresql://wberg:pass/word@localhost/mydatabase'
engine = sqlalc... |
Python SQLITE3 SELECT query with datetime calculated string not working
Question: I have a SQLite3 DB with a table named `TEST_TABLE`, which looks like this:
("ID" TEXT,"DATE_IN" DATE,"WEEK_IN" number);
There are 2 entries in the table:
1|2012-03-25|13
2|2013-03-25|13
I'm t... |
python list vote(['G', 'G', 'N', 'G', 'C'])
Question:
vote(['G', 'G', 'N', 'G', 'C'])
I want to get this result : `('G', [1, 3, 0, 1])`
g_count = 0
n_count = 0
l_count = 0
c_count = 0
for i in range(len(ballots)):
if ballots[i] == 'G':
g_count += 1
e... |
Python - Updating contents of option menu
Question: So the problem I am currently having is that I want to update the second
option menu, based on what the user selected in the first. I think I have to
use a lambda function here to make it so that the frame updates or something,
but I am unsure of how exactly to do thi... |
Python Tkinter rotate image animation
Question: I have a PhotoImage that I created using PIL and then added to a TKinter
canvas. The image shows up fine. However, I can't get the PIL rotate function
to work correctly. Here is my code:
#This works fine
image = Image.open('img.png')
canvas_image... |
is there any way to jump to a specified function name using help() command in python
Question: I always use `help(object)` command in python and I would like to know is
there any way I can skip most of the text and kinda jump to the function that
I want. For example:
>>> import boto
>>> s3 = boto.con... |
Finding text in json with python
Question: I've got a json file that I'm importing into Python and trying to look for the
occurrence of a phrase. If I try this:
any(keyword in s for s in json_data)
where keyword is the thing I'm looking for and json_data is what I got from
using json.load(). It alw... |
How to read a pdb file and perform FFT based docking using python?
Question: Suppose I have two PDB files (one of them is as follows)
ATOM 1 N MET A 1 66.104 56.583 -35.505
ATOM 2 CA MET A 1 66.953 57.259 -36.531
ATOM 3 C MET A 1 67.370 56.262 -3... |
Drawing Stars with turtle in python
Question: I need to write a function that draws random stars based upon the question of
how many stars the person wants. a=color,b=length and c,d are the starting
coordinates. I am not really sure where I am going wrong any tips,hints or
help would be appreciated.
impo... |
How to tell if python instance was compiled as framework?
Question: How can one tell if a given instance of Python (on OS X) was compiled with the
`--enable-framework` flag?
The one thing I tried is not entirely conclusive:
% python -c 'import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars()... |
python mock Requests and the response
Question: I am a beginner to using mock in python and trying to use
<http://www.voidspace.org.uk/python/mock>. Please tell me the basic calls to
get me working in below scenario. I am using pythons Requests module.
In my views.py, I have a function that makes variety of requests.g... |
How to Setup LIBSVM for Python
Question: I built [libsvm](http://www.csie.ntu.edu.tw/~cjlin/libsvm/) on Mac OS X with
Make.
$ tar xzfv libsvm-3.17.tar.gz
$ cd libsvm-3.17
$ make
This built the various libsvm binaries:
$ ls
COPYRIGHT heart_scale svm-predict.c s... |
Scipy sparse matrices - purpose and usage of different implementations
Question: Scipy has [many different types of sparse matrices
available](http://docs.scipy.org/doc/scipy/reference/sparse.html). What are
the most important differences between these types, and what is the difference
in their intended usage?
I'm dev... |
src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
Question: 1. I am running the following comand for installing the packages in that file " `pip install -r requirements.txt --download-cache=~/tmp/pip-cache`".
2. requirement.txt contains pacakages like
# Data fo... |
Co-dependent default arguments
Question: I have code like so:
import random
def helper():
c = random.choice([False, True]),
d = 1 if (c == True) else random.choice([1, 2, 3])
return c, d
class Cubic(object):
global coefficients_bound
def __in... |
Python Google App Engine Receiving a string in stead of JSON object
Question: I am sending a HTTP POST request from android to a server using the script
below
URI website = new URI("http://venkygcm.appspot.com");
HttpClient client = new DefaultHttpClient();
... |
Python requests library pre_request hook
Question: I'm having an issue with trying to switch from an ancient version of python-
requests (0.14) to a newer version (1.1, 1.2 whatever). The problem is that we
have a system which posts images on twitter using the following library:
<https://github.com/maraujop/requests-oa... |
Photo folder string replacement Regular Expressions python
Question: I would like to replace
text = '2012-02-23 | My Photo Folder'
with
new_text = '20120223_MyPhotoFolder'
I found a regular expression that matches my date format here
<http://regexlib.com/RETester.aspx?regexp_id... |
Python - plotting large number of lines
Question: I am trying to read in a file containing XY endpoints of line segments and a
value associated with the segment, then plot the line segments colored by the
value given. The problem I am having is that there is potentially hundreds of
thousands to millions of line segment... |
Python processing for loop for comparison
Question: I need to compare 2 tables of similar schema and have 2 generator objects..How
do I compare these 2 generators row by row in Python. Need to implement the
file comparison logic,
If generator-object-1 = generator-object-1:
then read-next-row... |
Trouble coding an LED selector in Python
Question: I have 4 LEDs connected to GPIO outputs of a Raspberry Pi. I want to use the
argv command so that I can select the LEDs using a simple binary code. For
example:
python test.py 1010
This would light up the first and third LEDs in the row. The problem is I
don't think ... |
removing linebreaks in python?
Question: I'm working on a simple python game in which the player attempts to guess
letters contained in a word. The problem is, when I print a word, it's
printing the \n at the end.
From my initial research, I think I need to use r.string() to remove it.
However, I'm not sure where it w... |
Why do I have to do `sys.stdin = codecs.getreader(sys.stdin.encoding)(sys.stdin)`?
Question: I'm writing a python program which upper-cases all input (a replacement for
the non-working `tr '[:lowers:]' '[:upper:]'`). The locale is `ru_RU.UTF-8`
and I use `PYTHONIOENCODING=UTF-8` to set the STDIN/STDOUT encodings. This
... |
Numpy not converting to new version
Question: I just installed Numpy 1.7.1 on Ubuntu by downloading the `tar.gz` file from
[Sourceforge](http://sourceforge.net/projects/numpy/files/NumPy/1.7.1rc1/). I
did `tar zxvf` on the tar file, then `python setup.py build` and `sudo python
setup.py install`.
But my Numpy is still... |
remote db initialization in Flask application
Question: I have flask app running on Server-A with mysqlDB. Before using the app we did
something like this:
$ python -c "from your_app import db; db.create_all()"
to initialize the DB. Now we are planning to move DB to a new server,
Server-B. So the a... |
Opencv 2.4.3 estimateRigidTransform in python
Question: This is really a mess for me and I have a hard time trying to solve this. I
want to use the method cv2.estimateRigitTransform in Python with numpy arrays
but I can't find anywhere an example or something else that explains the
format of the src and dst numpy array... |
What is causing the variance in the execution time of this python script?
Question: I have a simple python script however it displays a much higher execution time
when it's run for the first time in a while. If I execute it immediately after
it's faster by a few factors.
This script is run on a private test server wit... |
Django - call original and overriden save method
Question: This may be a noobish question but it bothers me quite a lot (I'm quite new to
both django and python)
In my django app, I overrided the save() method of a model to perform some
interaction on the file system.
I created a form class like this :
... |
Finding first N occurrences of regex in Python
Question: So this should be easy but I somehow miss the answer on SO or Python docs. I
am using this code:
myregex.findall(source)
This produces all matches of myregex as a list. Now, the problem is that
source is long and I only need first 6 occurrenc... |
Converting a matrix created with MATLAB to Numpy array with a similar syntax
Question: I'm playing with the code snippets of the course I'm taking which is
originally written in MATLAB. I use Python and convert these matrices to
Python for the toy examples. For example, for the following MATLAB matrix:
s... |
Why isn't Python importing this correctly?
Question: So, I have two files, HelloWorld.py and EnterExit.py. Here is the code for
HelloWorld:
import EnterExit
print('Hello world!')
print('What is your name?')
myName = input()
print('It is good to meet you, ' + myName + '!')
end()
... |
Django: How to set foreign key checks to 0
Question: Ok so i'm migrating database from sqlite to mysql , i had few errors but i
already resolved them. Now i have problem with this option because i don't
know how to disable it. I tried
DATABASES = {
'default': {
'ENGINE': 'django.db.back... |
matplotlib major display issue with dense data sets
Question: I've run into a fairly serious issue with matplotlib and Python. I have a
dense periodogram data set and want to plot it. The issue is that when there
are more data points than can be plotted on a pixel, the package does not pick
the min and max to display. ... |
Can this cmp function be better written as a key for sorted()?
Question: I was writing a solution to the problem of how to generate the maximum integer
by rearranging then concatenating integers from a set. I was given that for
the maximum integer, the arrangement of any two of its adjacent integers from
the set when e... |
Python module and object names clash
Question: Please consider the following Python modules excerpts:
foo.py:
class Foo:
(...)
bar.py:
import foo
foo = foo.Foo()
The variable foo, which was a module object, is overwritten with a Foo object.
I know that I can us... |
Reading and writing unique XML tags in Python
Question: I want to take a .txt file in XML of this sort:
<?xml version = ""?>
<data>
<a1>cat</a1>
<a5>bird</a5>
<a4>window</a4>
</data>
count the length of each string and output:
<?xml version = ""?>
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.