text stringlengths 226 34.5k |
|---|
Django template not loaded when deploy on openshift
Question: Totally new to Openshift and has been following various stepbystep guides.
Able to get django 1.6, Python 2.7 and Mezzanine 3.0.9 up with the application
working - partially. For some reason, the template is not loaded, both if the
template is part of a HTML... |
pandas sparse data frame value_counts not working
Question: I am encountering a TypeError with a pandas sparse data frame when I use the
value_counts method. I have listed the versions of the packages that I am
using.
Any suggestions on how to make this work ?
Thanks in advance. Also, please let me know if any more i... |
python - ryu handling packets using a switch after flow was added to switch
Question: I'm using a Ryu open flow controller switch written in python to monitor
packets in my virtual mininet.I have 3 hosts and I'm blocking transportation
from host2 to host3 and from host3 to host2. Other packets are added to the
switch f... |
String replacement in excel using Python
Question: I want to remove `%` and replace with a string, and to remove space and
replace it with under score.
This is what I have done so far:
# Open Excel file from a user imput
import xlrd, xlwt
filename = raw_input("Enter Excel file name with extensio... |
Read multiple bytes in Hexadecimal file using python
Question: I have a hex file which appears as below:-
00000000 AA AA 11 FF EC FF E7 3E FA DA D8 78 39 75 89 4E
00000010 FD FD BF E5 FF DD FF AA E9 78 67 84 90 E4 87 83
00000020 9F E7 80 FD FE 73 75 78 93 47 58 93 EE 33 33 3F
I want to read... |
Caught SyntaxError while rendering: invalid syntax
Question: I am creating an django app 'cms' with django1.1 via 《Python Web Development
with Django》. And I`m getting an "TemplateSyntaxError" error while accessing
admin page.
Here's the traceback:
TemplateSyntaxError at /admin/
Caught SyntaxError w... |
How to import python-mysql package not installed in virtualenvironment?
Question: I installed python-mysql using the following:
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python>
The issue is on install, I have only the option to pick my root python install
C:\Python27 and no virtualenvironment.
When I create ... |
How to convert a string (with non-digit place value separators) into an integer?
Question:
price = '20,355'
This is a python string variable. How do I convert it into an integer
variable?
For example:
price = 20355
Answer: This is my prefered way to convert strings with place-value s... |
Python : How to make QGroupBox borderless
Question: What QGroupBox attribute needs to be set to hide its outline borders?

from PyQt4 import QtGui, QtCore
import sys, os
class Dialog_01(QtGui.QMainWindow):
def _... |
Using a declared variable to divide by number in PythonWin
Question: I declared my variables but as with other intro programming languages, I have
been able to do simple division once the variable is set. I can see Python is
a bit different. Here's what I have:
import arcpy
from arcpy import env
... |
Python: Tkinter: Why is it root.mainloop() and not app.mainloop()
Question: I'm a new member to Stack Overflow. I found this thread, but was not allowed
to comment or ask questions on it, so I thought I'd just reference it here:
[How can I make a in interactive list in Python's Tkinter complete with
buttons that can ed... |
Java soap client to wsdl url
Question: i want to call soap function with a few parameters. I did it python but how
can i do it on java ?
my code on python :
url = 'http://78.188.50.246:8086/iskultur?singleWsdl'
client = Client(url)
d = dict(UserId='a', UserPass='b', ... |
loop through all methods in a python program
Question: I want to do something like this:
def a():
# do stuff
return stuff
def b():
# do stuff
return different_stuff
def c():
# do one last thing
return 200
for func in this_file:
print fu... |
Replacing a column with another predefined column
Question: Currently I have a very simple question. I'm using Python 2.7 and have the
following.
from pylab import *
import numpy as np
Nbod = 55800
Nsteps = 7
r = zeros(shape=(Nbod, Nsteps))
r_i = np.random.uniform(60.4,275,Nbod)
... |
Mapping lots of similar tables in SQLAlchemy
Question: I have many (~2000) locations with time series data. Each time series has
millions of rows. I would like to store these in a Postgres database. My
current approach is to have a table for each location time series, and a meta
table which stores information about eac... |
Nonetype object has no attribute 'id'
Question: I am retrieving the last id from mssql and trying to incrementing it and
storing the fie name with the id.. But I am getting "Attribute error :
Nonetype object has no attribute 'id'"..The code and the error goes here :
import Tkinter,tkFileDialog
impor... |
How to represent byte json string in Python
Question: I am working with Python and Zookeeper as I am using kazoo library in Python.
This question is not about Zookeeper or kazoo library. I guess this is mainly
related to Python.
Below are my two variables -
new_error_str = "Error occurred on machine %s ... |
How to structure python application
Question: I have been a PHP developer for the last decade, but figured it might be a
wise move to learn another language. Like Python.
Python in and off itself isn't so hard to understand when you've got a
background in programming.
What I can't yet understand though is how to str... |
Mezzanine ImportError when running tests
Question: I have recently upgraded the version of Django from 1.5.5 to 1.6.2 and
Mezzanine to 3.0.9.
When I run
python manage.py test
All the tests run without problem.
But When I run project specific tests using
python manage.py test <proje... |
python - check if list entry is contained in string
Question: I have a script where I'm walking through a list of passed (via a csv file)
paths. I'm wondering how I can determine if the path I'm currently working
with has been previously managed (as a subdirectory of the parent).
I'm keeping a list of managed paths li... |
Take column average of one file, repeat for all .txt files, write all averages to one file in python
Question: I have approximately 40 *.txt files, which all contain two columns of data -
they have been converted to str format from a previous script and are space
delimited. I would like to take the average of the secon... |
(?:) regular expression Python
Question: I came across a regular expression today but it was very poorly and scarcely
explained. What is the purpose of `(?:)` regex in python and where & when is
it used?
I have tried this but it doesn't seem to be working. Why is that?
word = "Hello. ) kahn. ho.w are 19... |
Replacing all regular expression matches except a certain character
Question: I would like to please know how I can replace all regular expressions matches
except for a certain chosen character.
I need to clean data. An example of the data is
`some-really,dirty.data%#$_.`
which I would like to loo... |
XML Tree parsing with condition in Python
Question: Here is my XML structure:
<images>
<image>
<name>brain tumer</name>
<location>images/brain_tumer1.jpg</location>
<annotations>
<comment>
<name>Patient 0 Brain Tumer</name>
<description>
T... |
Faster way to shift a decimal in Python to remove zeros?
Question: I have a variety of numbers that are always bounded by 0 and 1. The numbers
range in value such as
.9, .08, .00024, .00000507
My goal is to convert these numbers to the following
.9, .8, .24, .507
That is, I wan... |
Django/Python: confusion on class Classname(models.Model) parameter
Question: I cannot understand the models.Model parameter and what exactly it does here.
I am learning django on the job and this is my first software project. Here is
a piece:
class DocumentRequest(models.Model):
#contact info fi... |
Python 2.7 formatting data for writing as csv
Question: I'm trying to write data into a CSV file. I have data from several sensors and
time/date from a Real Time Clock. The sensor data is fine but I'm going round
in circles with formatting the RTC data. I've tried lots of things and read as
many relevant posts as my ag... |
qmath very strange AttributeError
Question: I'm trying to use qmath, a quaternion lib.
this
from qmath import qmathcore
a = qmathcore.quaternion([1,2,3,4])
print a.conj()
gives me such traceback
Traceback (most recent call last):
File "*******/q_test.py", line 25, in ... |
How to enable logging at the initialization of the module in Python?
Question: I am having the following code:
#! /usr/bin/python
import logging
import test_log
def main():
logging.error("hello")
if __name__ == '__main__':
logging.basicConfig()
main(... |
Catch mouse clicks in python
Question: I'm trying to catch mouse click events in my python code (not just clicks in a
`Gtk` window I created but anywhere in the screen). After some search, I found
a thread talking about `xlib` (great, a dependency I already had).
from Xlib import display, X
disp... |
logic of regex in python
Question: I always have a hard time understanding the logic of regex in python.
all_lines = '#hello\n#monica, how re "u?\n#hello#robert\necho\nfall and spring'
I want to retrieve the substring that STARTS WITH `#` until the FIRST `\n`
THAT COMES RIGHT AFTER the LAST `#` \- ... |
BeautifulSoup webscraping find_all( ): finding exact match
Question: I'm using Python and BeautifulSoup for web scraping.
Lets say I have the following html code to scrape:
<body>
<div class="product">Product 1</div>
<div class="product">Product 2</div>
<div class="product specia... |
How do I sort objects inside of objects in JSON? (using Python 2.7)
Question: I have the following code, which is a function to export a transaction history
from a digital currency wallet to a json file.
The problems I am facing are two:
1. I would like to allow the json file to be written in utf-8, as the property... |
Selenium python how to use assertEqual method from unittest.TestCase "No such test method in <class 'unittest.case.TestCase'>"
Question: I try to use assertEqual in usual class and can't call method from
unittest.TestCase
class MyPages(unittest.TestCase):
@classmethod
def... |
Underflow issue in Python
Question: I need to draw the following function, which is what I call theory data

with a=z-(L/2) b=z+(L/2) for the following case
* N=75
* I=1
* L=0.16
* R=0.013
for z between -0.011 and 0.011. My guess is that the... |
How to save an animation without showing the previous frames in the video?
Question: I would like to save an animation using Python but I get the frames
superposed! I want to get the frames displayed individually. Please here what
I used:
import numpy as np
from matplotlib import pyplot as plt
fr... |
pysfml breaks on runtime while displaying a render window
Question: im using pySfml with python3.3 x64 when i simply want to display a window it
breaks . it runs normally and everything is working for 2-3 seconds . then the
window gets non responding while my pytho script is actually still working and
everything is fin... |
How to extend a templated c++ class in python with SWIG to allow the [] operator
Question: I have a templated c++ array class which uses the standard vector class:
#include <vector>
#include <string>
using namespace std;
template<typename T>
class Array1D{
private:
v... |
flask module import failure from test folder
Question: How do I import modules located up (out of a test folder) and then back down
my app folder structure?
in the app_test.py folder I want to
from app.models import User
running
/bin/python app_test.py
I get
no ... |
Use Apache 2 + mod_wsgi for Python app
Question: I'm trying to use Apache 2 + mod_wsgi for my Python app. But get an error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaste... |
Adding a numeric type between Real and Rational, and supporting the type's functionality for Rational numbers
Question: Python offers [a set of abstract base
classes](http://docs.python.org/3/library/numbers.html) for types of numbers.
These start with `Number`, of which `Complex` is a subclass, and so on through
`Real... |
Comparing and then appending rows to csv file in python
Question: I am trying to compare two columns from _result.csv_ and *street_segments.csv*
and then if they are the same append columns from *street_segments.csv* to
_results.csv_.
import csv
count=0
count1=0
count2=0
first = file('res... |
In over my head: Debugging and many errors
Question: I am trying to write a program for connect 4 but am having a lot of trouble
getting past the directions. Everything under the comment, "#everything works
up to here" works but then it all explodes and I have no idea even where to
start to fix it.
#conn... |
Git tree-filter run python script on commits
Question: I was asked this question on `#git` earlier but as its reasonably substantial
I'll post it up here. I want to run a `filter-branch` on a repo to modify
(thousands of) files over hundreds of commits using a python script. I'm
calling the `clean.py` script using the ... |
How to make unique combinations of the following list of tuples
Question: In python, I have a list containing the following tuples:
[(Bob, Tom), (GreenWood, Pearson)]
First `tuple` contains first names and second `tuple` contains last names.
_PS: The list I gave is a sample, the actual list varie... |
Query on local frame and global frame in python Environment
Question: From the below program, I understand that local frame(square)(blue colour box)
in the below Environment diagram belongs to(nothing but), the local ACTIVATION
RECORD of **call**() method of an object of class 'function'. This 'function'
class object i... |
zip() in python, how to use static values
Question: I'm trying to build an array of tuples with first value from list with some
static values.
It should be simple but I'm struggling to do this for some reason.
For example, how do I get the following:
[(1,100,200),
(2,100,200),
(3,100,200),... |
Python: How to deal with Editable ComboBoxes when its Items used to store Objects (data)
Question: A following code creates a simple ComboBox with 12 pull-down items. To each
item there was assigned an instance of MyClass() - the variable _myObject_
using
`self.ComboBox.addItem( name, myObject ).`
The ComboBox itself... |
How to pass results of urllib2.urlopen to a function
Question: WHen I run this I get the following error - TypeError: coercing to Unicode:
need string or buffer, NoneType found
Can someone please tell me how I can pass the results of function getURL() to
function romid()?
#! /usr/bin/env python
# -*... |
python too many values to unpack error and blank output
Question: I lost my previous account id so I am starting new.
templist=[]
temps1=[]
templist2=[]
tempstat1={}
station1={}
station2={}
import os.path
def main():
#file name=animallog.txt
en... |
PanedWindow issues with text widgets
Question: I have a couple of issues working with PanedWindow - which I do not well and
I'm a bit confused.
In this example I'm trying to put 2 text widgets side-by-side:
#!/usr/bin/env python
import os
from Tkinter import *
import ttk
root ... |
Assigning value to the variable in Qt
Question: Here is the converted .ui of Qt to the .py:
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_NewWindow(object):
def setupUi(self, NewWind... |
Why is my UI element invisible until the user resizes the window?
Question: I have a custom progress bar–like view that basically consists of two sizers
side by side: the one on the left has a red background and the one on the
right has a light gray background. By adjusting the relative sizes of the
sizers I can indica... |
Plotting the function 1/x and -1/x^2 on python in the interval from (-1,1)
Question: Please look at my code and help me. I'm writing a code the approximates the
Derivative of a function. To visually check how close my approximation is with
the real derivative, I'm plotting both of them together.
My problem is when the... |
pcolormesh use of memory
Question: I've been struggling with this for a while. I have a set of images, I perform
some math on the X, Y coordinates of these images and then plot the new images
using pcolormesh. All the calculations I've already done, all I do is load the
new X's and new Y's and use the colors from the i... |
Mule jython running with main
Question: > Problem:
How to run a jython having main function in Mule application?
Issue:
I have a simple Jython code invoked by mule flow.
Flow:
<mule xmlns:...
<flow name="wfileFlow1" doc:name="wfileFlow1">
<http:inbound-endpoint ... |
Parse/Creating Types in Python
Question: I'm trying to figure out how to create types and convert the users input
according to those types. For example:
user enters: 5
5 is of type Number 5 gets added to the list
user enters: 3.5
3.5 is of type Number 3.5 gets added to the list
user enters: :true:
:true: is of ty... |
Creating two button methods Python
Question: I am creating a program in Python that creates a shape based on user input. I
need to create two functions to create buttons using [Zeller's
graphic.py](http://mcsp.wartburg.edu/zelle/python/graphics.py) file. One
button needs to say Quit and the second needs to say Process.... |
How to do inputs in Python
Question: I have to open file in Python, what looks like this:
Rapla;Tartu;157
Tallinn;Narva;211
Valga;Haapsalu;249
Viljandi;Paide;71
Tartu;Rakvere;123
Rapla;Narva;259
Paide;Narva;196
Paide;Tallinn;92
I want to get program to work like this wit... |
Python reading file to dictionary
Question:
templist=[]
temp=[]
templist2=[]
tempstat1={}
station1={}
station2={}
import os.path
def main():
#file name=animallog.txt
endofprogram=False
try:
filename=input("Enter name of input file >... |
Setting up Django on apache with mod_wsgi
Question: Trying to setup Django on apache on CentOS 6 using mod_wsgi but I'm not sure
what I have setup wrong. I've tried alot of different setup guides but i
always get the same error in the apache logs:
[Mon Mar 31 19:51:22 2014] [error] [client ::1] mod_wsgi ... |
python multithreading with list I/O
Question: I'm wanting to achieve multithreading in python where the threaded function
does some actions and adds a URL to a list of URLs (`links`) and a listener
watches the `links` list from the calling script for new elements to iterate
over. Confused? Me too, I'm not even sure how... |
Trouble importing a Python module
Question: I'm new to Python and having trouble importing from a different directory.
The file I'm currently in has the path home/pi/example.py
The module I'm trying to import into this file has the path
home/pi/ReactiveEngine/src/PiEngine.py
I've tried the following:
... |
display an rgb matrix image in python
Question: I have an rgb matrix something like this:
image=[[(12,14,15),(23,45,56),(,45,56,78),(93,45,67)],
[(r,g,b),(r,g,b),(r,g,b),(r,g,b)],
[(r,g,b),(r,g,b),(r,g,b),(r,g,b)],
..........,
[()()()()]
]
i wan... |
Python pandas Google finance international stocks - looking for way to get international stocks price history with Google
Question: This works: domestic stocks
gticker='NYSE:IBM'
import pandas.io.data as web
dfg = web.DataReader(gticker, 'google', '2013/1/1', '2014/3/1')
This does not: inte... |
Auto kill process and child process of multiprocessing Pool
Question: I am using multiprocessing module for parallel processing. Bellow code snippet
search the string filename in X location and return the file name where the
string found. But in some cases it take long time to search process so i was
trying to kill the... |
How to parse JSON passed on the command line
Question: I am trying to pass JSON parameters through command line in Python:
automation.py {"cmd":"sel_media","value":"5X7_photo_paper.p}
how can I extract the values `sel_media` and `5X7_photo_paper.p`?
I used the following code, but it is not working... |
Streams in computing
Question: In the world of computing, majorly i've been reading python programming
language and the socket module I understand that the sockets in communication
are just communications end-points, which every communication done uses a
socket.
import socket
#Importing the low-level... |
Using a queue for synchronous multiprocessing
Question: I have a python program which reads a line from a file, processes the line and
then writes it to a new file. It repeats this for all lines in the file.
Essentially:
for i in range(nlines):
line = read_line(line_number = i)
processed_... |
Statistical Significance in terms of Gaussian Sigma
Question: I'm working on an issue in my research where I would like to express my
statistical significance for a correlation peak in terms of sigma of a normal
distribution. For example, if my peak was at 95% significance it would be at
2sigma. Essentially what I'm as... |
Teradata 'Unable to get catalog string' error when using ODBC to connect
Question: I am trying to reach a remote host that is running Teradata services via ODBC.
The host that I am trying to connect from is 64-bit RHEL 6.x with the
following Teradata software installed:
1. bteq
2. fastexp
3. fastld
4. jmsaxsm... |
Python script to read a text file and write into a csv file
Question: I have a text file in which each row has multiple words (which I want to
consider as columns). Now I want to read all the data from this text file and
create a csv file with rows and columns. I am written the code till here -
import cs... |
Text parsing convert equation blocks to Python statements
Question: I have a big group of SAS equation statements, and would like to use Python to
convert those equations to Python statements. They look like the following:
From SAS:
select;
when(X_1 <= 6.7278 ) V_1 =-0.0594 ;
... |
django csv import encoding
Question: I am using the Django csv import (<https://pypi.python.org/pypi/django-
csvimport>) to populate some models. The problem is the csv files I have are
encoded in ANSI (Windows-1252) format and they have words with special
characters e.g. JOSÉ, when I import to my models the word becom... |
Error converting .py to executable using cx_freeze
Question: I am using python 3.3.3
the following is my setup.py code
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
base = None
if sys.platform == "w... |
Horizontal Lines in Tkinter Python
Question: Trying to draw an 8 x 8 grid in Tkinter and I have the vertical lines drawn,
but I can't seem to draw the horizontal lines correctly. Please help!
Here's my code:
from tkinter import *
class CanvasGrid:
def __init__(self):
self.window = T... |
Can one define functions like in JavaScript?
Question: In Python, can one define a function (that can have statements in it, thus not
a lambda) in a way similar to the following JavaScript example?
var func = function(param1, param2) {
return param1*param2;
};
I ask, since I'd like to h... |
Parsing a PDF via URL with Python using pdfminer
Question: I am trying to parse this file but without downloading it off of the website.
I have run this with the file on my hard drive and I am able to parse it
without issue but running this script it trips.
if not document.is_extractable:
raise PDFTe... |
Determine which numbers in list add up to specified value
Question: I have a quick (hopefully accounting problem. I just entered a new job and the
books are a bit of a mess. The books have these lump sums logged, while the
bank account lists each and every individual deposit. I need to determine
which deposits belong t... |
Useing python to download a file in google drive that is created by a google app script
Question: Ok so I've got a google script that I'm working on to help out with some stuff
and I need to be able to create a txt file and download it to my local
computer. I've figured out how to create the file as a blob and create a... |
NameError: name 'install' is not defined when installing packages using pip
Question: I am trying to create virtualenv and install project dependencies using pip.
$ mkvirtualenv --no-site-packages --distribute myenv
(myenv)$ pip install -r requirements.txt
I also set up `export VIRTUALENV_DISTR... |
How to make Conditional Probability Tables (CPTs) for Bayesian networks with pymc
Question: I would like to build a Bayesian network of discrete (pymc.Categorical)
variables that are dependent on other categorical variables. As a
[simplest](https://raw.githubusercontent.com/shpigi/pieces/master/ab.png)
example, suppose... |
Selenium Python webdriver: driver.get() won't accept a variable?
Question: I'm trying to write an automated test script that will perform a set of
actions for multiple URL's. The reason I am trying to do this is because I am
testing a web application with multiple front-end interfaces that are
functionally exactly the ... |
How do arrow keys work with getch? (they register as 3 keys)
Question: I'm using the `getch` code [from this stack overflow
question](http://stackoverflow.com/questions/510357/python-read-a-single-
character-from-the-user), and I've written the following script:
getch = _Getch()
while(1):
test... |
What is the best way to generate Pythagorean triples?
Question: I have tried with that simple code when you just check all the combinations
for a and b and then check if square root of c is an integer, but that code is
really slow, then I have tried with Euclid's formula
a = d*(n^2 - m^2)
b = 2*n*m*d... |
How to get the hardest part to take longest in python
Question: I have some simple code as follows.
count =0
iters = 1000000
l=10
k=10
for i in xrange(iters):
t = np.random.choice([-1,1],size=l+k-1)
v = np.random.choice([-1,1], size = l)
if (not np.convolve(v, ... |
How to create a table in SQLite using python without rowid?
Question: I would like to create an SQLite table in python without the default rowid
field.
For example, I have tried
import sqlite3
conn = sqlite3.connect("mydatabase.db")
cursor = conn.cursor()
sql = "CREATE TABLE tblTes... |
Plotting boxplot in matplotlib with without data array?
Question: Is there a way to create plots in **matplotlib** without having raw data?
I have a tool which reports `Mean`, `Max`, `Min`, `standard_daviation`,
`P_50`, `P_90`, and `P_99`, but does not give all the data-points. I am trying
to create a plot boxplot lik... |
Get a file from an ASPX webpage using Python
Question: I'm trying to download a CSV file from this site, but I keep getting an HTML
file when I'm using this piece of code (which used to work until a few weeks
ago), or when I'm using wget.
url = "http://.....aspx"
file_name = "%s.csv" % url.split... |
TypeError: can only concatenate list (not "tuple") to list ((Python))
Question: When running the following code in a little script, I get the following error:
Traceback (most recent call last):
File "/Users/PeterVanvoorden/Documents/GroepT/Thesis/f_python_standalone/python_files/Working_Files/testc... |
Django:python manage.py not woroking but python2.7 manage.py is
Question: I HAVE A Weird Kind of Error.When I run manage.py in virtualenv it shows me an
error
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_l... |
why cv2.imshow() results in error in my python compiler?
Question: Hi friends i just now installed opencv and checking the basic code but it
results in error. The code is
import numpy as np
import cv2
img=cv2.imread('C:\Users\Pravin\Desktop\a.jpeg',1)
cv2.namedWindow('img',cv2.WINDOW_NORMAL)
... |
An explanation of randint(2) < 1 in python, I cannot understand what the < 1 does
Question: In python, given **randint(2) < 1**, could someone please explain what the **<
1** means or does?
I am using IP[y]: Notebook
Please excuse the previous lack of information, this is the code
%pylab inline
fro... |
How to forward a websocket server in localhost with ngrok
Question: I' trying to run a websocket server on local host and forward it to web using
ngrok. But couldn't figure it how. These are the original code's from
AutobahnPython git repository <https://github.com/tavendo/AutobahnPython>.
Server code:
... |
Counting similar list element in a list
Question: I have a list of lists
list = [[1,0],[1,2],[1,1],[1,0]]
Now I want to count the number of occurrences similar list elements in the
above list. e;g; `[1,0]:2, [1,2]:1, [1,1]:1`
I did
import collections
print Counter(list)
It... |
creating a table in sqlite3 python
Question: I apologize in advance for asking such a basic question but I am new to
SQlite3 and having trouble starting. I am trying to build a database with one
table. I used the following code to build a table.
import sqlite3
conn = sqlite3.connect('example.db')
... |
How to view file handling functions documentation using help function in Python 3?
Question: I'm trying to view file handling functions documentation inside Python Idle
using `help()` function.
So far, I've done and got the following:
>>> fh = open('file.txt', 'w')
>>> help(fh.seek)
Help on buil... |
Python Oauth Request to Twitter Yields Response 403 - SSL is Required
Question: Using Python's oauth2 library I've been attempting to implement a three-legged
oauth request (as outlined here - <http://www.linuxuser.co.uk/news/handling-
twitters-three-legged-oauth-process>) to Twitter only to obtain a 403 response
- "SS... |
Hard time finding Python-Numpy deg2rad function
Question: Title says it all, I somehow can not find that function. Obviously it's inside
the Numpy package (numpy.core.umath.deg2rad) and I've tried importing it but
to no avail. Anyone care to chime in?
* import numpy as np - np.deg2rad doesn't even show up
* from n... |
can write to rs232 serial instrument but can't read from it
Question: I have an rs232 serial device and I am trying to read and write to it using
python with pyVISA. I am able to write my commands to it using "write" but I
If I try to us "read" or "ask" I get a timeout error.
I can read and write to it easily through ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.