text stringlengths 226 34.5k |
|---|
scikit-bio not working after installation
Question: I have installed scikit-bio on my mac and when I run `python -m skbio.test`, I
get the following error:
File "/macqiime/anaconda/lib/python2.7/site-packages/skbio/io/tests/test_util.py", line 17, in <module>
import httpretty
ImportError: No modu... |
How to use pydoc to generate a list of methods and properties in a Python file
Question: I have some classes that I wrote, and in some of them I did add some docs
strings, like in the class header.
Now I would like to use pydoc, to generate documentation, but I realized that
pydoc won't print anything unless I actuall... |
Split a list into chunks with multiple integer delimiters
Question: I have two list of integers, namely `numbers` and `delimiters`. I want to
divide `numbers` into chunks divided by `delimiters`.
## Example:
numbers = [10, 13, 7, 204, 129, 44, 12, 7, 17, 49, 216, 43, 16, 7, 7, 38, 29, 76, 54, 17, 39, 7,... |
Can import edgelist to igraph python
Question: I have a list of twitter followers in text file that I want to import to
iGraph.
Here's the sample of my list
393795446 18215973
393795446 582203919
393795446 190709835
393795446 1093090866
393795446 157780872
393795446 1580109739
39... |
How to make hexbin plots from a data file using seaborn?
Question: I'm pretty new to using matplotlib and seaborn, and I couldn't really find any
"for dummies" guides on how to do this. I keep getting error messages trying
to use code from the guides I can find. I guess I'm having difficulty taking
their pieces of code... |
transforming wordnet txt into lists in python nltk
Question: **I am running the following function:**
import nltk
from nltk.corpus import wordnet as wn
def noun_names(list):
for synset in list:
for lemma in synset.lemmas():
print lemma.name()
nou... |
Module being imported from another Python install
Question: I'm running multiple installs of Python on Windows Server 2012. I can probably
find a way to work around this, but I'm curious as to what is going on. I'm
wary about radically changing the installs in case I break other people's
Python scheduled tasks that I m... |
python, how parallelize several calls to the same function without lose execution time
Question: I have some trouble to parallelize a function. I would like use a function
several time in parallel way:
def f_diff_coord(vect1,vect2):
return vect1-vect2
This function need to be computed sever... |
python unicode in subprocess does not work same in console and in mod_wsgi
Question: On a python console I can run (echo of e acute):
import subprocess
cmd = u'echo "é"'
subprocess.call(cmd,shell=True)
But if I run that code in a Django view (mod_wsgi), It crashes :
subproces... |
Store User Value in an Entry box to calculate a value in Tkinter
Question: I am trying to calculate an equation from user input using Tkinter in python.
The code is as follows:
import math
from tkinter import *
def Solar_Param():
d = Interface.get()
S_E = 1367*(1 + 0.0334 ... |
How to create a module object by content in Python
Question: I have a string which contains a python code. Is there a way to create a
python module object using the string without an additional file?
content = "import math\n\ndef f(x):\n return math.log(x)"
my_module = needed_function(content... |
TortoiseHg error running HG
Question: I'm running into an error when pushing a local repository to the master
repository located on a network share in Windows 7. I've added a hook on the
master repository to perform "hg update" on push. When I'm running push from
the local repository in the TortoiseHg, I get this error... |
Retrieving Ms-access form properties in python
Question: I want to retrieve ms-access form dimensions through python, getting the
"width" is no problem, but "height" is not a direct property but consists of
partial heights of sections. In VBA these can be taken by
Form!fName.section(n).height. In python this fails. Doe... |
Python - Using function in parent from child
Question: ~~I am trying to make a module that when imported can be used to easily define
commands for an interactive 'console'. However this requires me to be able to
run a function from the parent file, which when I do so I get this:`<function
Test at 0x027234B0>` instead o... |
Using setuptools to create a cython package calling an external C library
Question: I am trying to compile, install and run a package that we'll call `myPackage`.
It contains a `*.pyx` file that calls the function `fftw_set_timelimit()` from
library `fftw`. Currently, when I run a script `clientScript.py` that imports
... |
Not turning variable to an int
Question: I wanted to make an rpg game based of the manga Deadmans Wonderland. I want to
change 'james' the variable which represents strenth, agility etc. It works ok
but it doesnt convert it to a int it keeps it as (hexidecimal I think?) I know
this because I asked it to print james.
H... |
flask-sqlalchemy: AttributeError: type object has no attribute 'query', works in ipython
Question: I'm creating a new flask app using flask-sqlalchemy and flask-restful with
Python 3.4. I've defined my User model as such:
from mytvpy import db
from sqlalchemy.ext.declarative import declared_attr
... |
Generate keystrokes in Linux from Python3
Question: I need to generate keystrokes in Linux (Raspbian) from Python3. Something like
`uinput` but for Python3. I'd prefer not to use `subprocess` for this.
Easier to install (apt-get) the better as it will be used in a guide to show
others.
Any ideas? Thomas
Answer: Fou... |
Python Regex - Capturing a sentence based on the beginning and ending
Question: I'm fairly new to python, but I'm attempting to write a program that will
capture a sentence out of a string, based of the beginning and ending of the
sentence.
For example if my string was
description = "11:26:16 ENTRY 'Ins... |
Python - search list with only a few characters entered
Question: I want to find the string that the user searches for. For example, if the user
enters FD-2** (he doesnt know what the * characters are), the search should
give FD-234 and FD-285. I have a piece of code:
rendszam = input('Adja meg a rendszá... |
Selenium Python Configure Jenkins to run build. My build fails
Question: I am trying to configure Jenkins to build my Selenium Webdriver Python code.
When i click Build Now it fails The Console output shows the following:
Building in workspace C:\Program Files\Jenkins\workspace\ClearCore
[ClearCore] ... |
How to set python exception messages to use a special language?
Question: I'd like to change the way python is handling the language of the returned
error strings, for example for WinError/OSError exception. I'm working with
ctypes and WinError is defined as
def WinError(code=None, descr=None):
i... |
Python Pandas: How to move one row to the first row of a Dataframe?
Question: Given an existing Dataframe that is indexed.
>>> df = pd.DataFrame(np.random.randn(10, 5),columns=['a', 'b', 'c', 'd', 'e'])
>>> df
a b c d e
0 -0.131666 -0.315019 0.306728... |
Count throws for sixes in rolling dice python
Question: For an introductionary course in Python I got an assignment to make a
simulation for eolling dice
You want all of your dices (5 in total) to get the value six, and count how
many throws in total it takes for a person to get all sixes. I need a loop
that simulates... |
Overlapping probability of two normal distribution with scipy
Question: i have two scipy.stats.norm(mean, std).pdf(0) normal distribution curve and i
am trying to find out the differential (overlapping) of the two curves.
How do i calculate it with scipy in Python? Thanks
Answer: You can use the answer suggested by ... |
What is installing Python modules or packages?
Question: A Python module is just a `.py` source file. A Python package is simply a
collection of modules.
So why do we need programs such as `pip` to 'install' Python modules? Why not
just download the files, put them in our project's folder and `import` them?
What exac... |
Natural time interval processing in Python
Question: I am wondering how to take a user-inputted string (i.e. `1 day, 5 hours, 15
minutes, 2 seconds`) and convert it to either a `timedelta` object or
(preferably) the number of seconds in that interval.
Note that:
* This is not a question about _[datetime](/questions... |
OS X: Self Packaged Kivy-Application does not work
Question: I wanted to put myself a bit into Python GUI programming and found Kivy, a
really cool Framework, Cross-Platform and open source.
Before I started to put my console-based python script into Kivy, I wanted to
test if I can make the program self running withou... |
Display two frames of the same class with Python and Tkinter
Question: I wrote a simple game in Python. Now I'm trying to give it a GUI (currently it
is text based). Since there aren't moving objects, I decieded to use Tkinter
(I like the grid arrangement, the east coding to get a menu and the fact that
there is no nee... |
How to run Scrapy/Portia on Azure Web App
Question: I am trying to run Scrapy or Portia on a Microsoft Azure Web App. I have
installed Scrapy by creating a virtual environment:
D:\Python27\Scripts\virtualenv.exe D:\home\Python
And then installed Scrapy:
D:\home\Python\Scripts\pip ins... |
How to subtract the value from the previous value in a list in python?
Question: I am trying to take values in a list, such as `[1,2,3]` and subtract them from
each other. So it would return `[-1,-1]` because the first value is `1-2` and
the second value is `2-3`. How would i achieve this in python? I have tried
... |
PySide/python video player issue
Question: I am trying to write a simple YUV video player using python. After some
initial study, I thought I could use PySide and started with it. As a first
step, I have taken the following approach without consideration for real-time
performance. Read YUV buffer (420 planar) -> conver... |
PyEphem reporting different latitude and longitude than input values
Question: I have used Pyephem to calculate the latitude and longitude of the sun given
date, latitude and longitude of an observer at sea level. I get results I do
not understand. The code I ran follows (on Ipython notebook in windows 7):
... |
What are Type hints in Python 3.5
Question: One of the talked about features in `Python 3.5` is said to be `type hints`.
An example of `type hints` is mentioned in this
[article](http://lwn.net/Articles/650904/) and
[this](http://lwn.net/Articles/640359/) while also mentioning to use type
hints responsibly. Can someon... |
Can't make migrations run after upgrading to Django 1.7
Question: I'm trying to upgrade my Django 1.6.2 application to Django 1.7.10 but am
stuck because the makemigrations command keeps raising an error. I've never
used migrations in this application. When I run the command "python
./manage.py makemigrations", I get t... |
Gunicorn Internal Server Error
Question: I'm setting up Gunicorn with my Flask application. I have the following file
structure:
Flask/
run.py
myapp/
__init__.py
views/
homepage/
__init__.py
homepage.py
login/
__init__.py... |
Python library module implementation
Question: I am trying to write - and understand - some python code , and I have been
struggling to realize how python libraries are imported. Let me describe my
situation.
I am trying to mock a raspberry-pi-only python library (RPi.GPIO) in order to
run some unittests in my (x86) l... |
JSON and Python - flatten JSON api for CSV with TypeError: list indices must be integers, not str
Question: Trying to flatten JSON-formatted data rec'd via API with a somewhat
unpredictable hierarchy with the goal of saving it as a CSV for import into
MySQL and I'm running into an error **_TypeError: list indices must ... |
Python pandas multiple conditions
Question: Sorry, I apologise now, just started learning Python and trying to get
something working.
Ok dataset is
Buy, typeid, volume, issued, duration, Volume Entered,Minimum Volume, range, price, locationid, locationname
SELL 20 2076541 2015-09-12T06:31:1... |
python "cannot import name 'geolite2'"
Question: I'm in trouble with import module using python
Here's the list when I list my installed package using cmd "pip list"
geoip2
maxmindb
pip
python-geoip
python-geoip-geolite2
request
setuptools
wheel
my python code starts
... |
Is wait_window() required for creating a modal dialog in Python Tkinter?
Question: I try to create a modal dialog using Python Tkinter. I found no difference
between using and not using wait_window().
import tkinter as tk
def button_click():
dlg = tk.Toplevel(master=window)
tk.B... |
Mock with submodules for ReadTheDocs
Question: I'm trying to document a Python project with ReadTheDocs. Initially, the build
process would die when it got to:
from osgeo import gdal, osr
I've read the [rtd faq](https://read-the-
docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-librar... |
Python - Loadtext with specific lines for huge file
Question: I have to get specific lines in a huge text file. Until now i try as below. My
aim is to extract columns for a specific iteration, here each 500 lines. But
by proceeding with the "readlines", sometimes i get some crashes because of
the size of the file (unti... |
How to make ffmpeg write its output to a named pipe
Question: I know i can make `ffmpeg` put its output to `stdout` and `stderr` using
`pipe:1` and `pipe:2`, respectively, as `output_file` parameter.
([Docs](http://ffmpeg.org/ffmpeg-protocols.html#pipe))
But what about [named pipes](https://en.wikipedia.org/wiki/Named... |
Convert cURL request to Python-Requests request
Question: I want to convert this cURL request to a Python-Requests request since I am
working on a Python wrapper for a REST service
MS_WORD_DOCUMENT=...
CONTENT_TYPE="application/msword"
JSON_REQUEST="{\"documentType\" : \"$CONTENT_TYPE\"}"
... |
Python: List files in subdirectories with specific extension created in last 24 hours
Question: First of all, I'm new to programming and Python in particular, therefore I'm
struggling to find a right solution.
I'm trying to search the files with specific extension recursively which have
been created only in last 24 ho... |
How to do mutation with word in python?
Question: I'm tryin to play with words. For example, I read word "script" from a txt
file. Then would like to do all mutations of letters and write each of them.
So here are changes
s=$
s=5
s=S
s=s
c=(
c=[
c={
c=<
c=c
c... |
remove all elements in a list not relatively prime
Question: I have a list `m` in python, and I want to remove all the elements in m that
are not relatively prime to all previous elements. So if `m=[2,3,4]` I want
the output to be `[2,3]`.
I tried iterating through the values of `m`, but it doesnt work since the size
... |
How can I select lines in reason of a value in awk?
Question: Let's assume I have a file which structure looks like this:
AAAA 700 something1 something_else1
AAAA 98 something2 something_else2
AAAA 2000 something3 something_else3
BBBB 200 something4 something_else4
BBBB 21 something5 some... |
Python OpenCV Template Matching error
Question: I've been messing around with the OpenCV bindings for python for a while now
and i wanted to try template matching, i get this error and i have no idea why
C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\templmatch.cpp:910: erro... |
MQTT subscriber to know who is the publisher
Question: From what I read in MQTT protocol [message
payload](http://www.hivemq.com/mqtt-essentials-part-4-mqtt-publish-subscribe-
unsubscribe/), it doesn't seem to support telling who is the publisher on a
published message. But is it possible that a MQTT subscriber to know... |
Is it possible to make a module iterable in Python?
Question: I am making a module that I want to treat as a static container of objects.
These objects are of a class type that I have defined. I want to be able to
import this module and then loop over the objects within. Here is some code
explaining what I mean:
**exa... |
Python Datareader Stock Exchange markets options
Question: I'm using Datareader to get some stock quotes from Yahoo finance. I would like
to get the values of Euronext Paris Stock exchange market and not the standard
values (NYSE ones I think).
import pandas.io.data as web
import time
... |
sudo pip install python-Levenshtein failed with error code 1
Question: I'm trying to install the python-Levenshtein library on linux, but whenever I
try to install it via:
sudo pip install python-Levenshtein
I get this error:
> Command "/usr/bin/python -c "import setuptools, tokenize;**file**
> ='... |
javascript HTML5 canvas display from python websocket server
Question: I created a websocket server that uses ZeroMQ4 to talk to a middleware. I also
created a peice of Javascript to display information back from the middleware.
I know the Websocket server works and is able to send to the javascript as i
tested with s... |
Cannot retrieve data from Strawpoll API
Question: I have a simple python code that goes to [this
link](http://maps.googleapis.com/maps/api/geocode/json?address=googleplex&sensor=false)
and retrieves it's data. Here is the code
import urllib, json
url = "http://maps.googleapis.com/maps/api/geocode/jso... |
Python - Permutation/Combination column-wise
Question: I have a list
mylist = [
['f', 'l', 'a', 'd', 'l', 'f', 'k'],
['g', 'm', 'b', 'b', 'k', 'g', 'l'],
['h', 'n', 'c', 'a', 'm', 'j', 'o'],
['i', 'o', 'd', 'c', 'n', 'i', 'm'],
['j', 'p', 'e', 'e', 'o', 'h', 'n'... |
Trouble with command line execution or R script file from within Python shell
Question: I'm currently using the `optparse` package cast an R script file as a command
line executable file that accepts C-style long and short flags. The program is
running on Ubuntu. The execution of the overall application is controlled b... |
Web scraper script - How can I make it run quicker?
Question: I just started with python 3 and love reading light novels, so the first
python project I made is a script which web scrapes & downloads my favourite
light novel.
Everything works fine so far but it is really slow, especially checking
whether a chapter is a... |
Undeclared, uninitialised variables being used in expressions: what to think?
Question: I'm struggling to understand the following code snippet (located in a file
called `program.js`. My issue is that I can't find where
`CODERBOT_PROG_SAVEONRUN` is declared and/or initialized in this file. No
external code or library s... |
Simple Calculator using HTML forms in python django
Question: Below is my html form:
<form id="calci_form" method="get" action="#">
<input type="hidden" name="prev_val" value="{{prev_val}}"></input>
<input type="hidden" name="curr_val" value="{{curr_val}}"></input>
<input type="hidden" nam... |
How to arrange lines into colums of csv file with python?
Question: I am a chemistry student and I am interested in performing conformational
analysis of molecules. I have performed a Potential Energy Surface Scan on the
cumaric acid in order to find the most stable conformer. With this simple
process the different spa... |
Python: How can the same socket object serve different clients?
Question: As is mentioned in the documentation: [Python
socket.accept()](https://docs.python.org/3/library/socket.html#socket.socket.accept)
> Accept a connection. The socket must be bound to an address and listening
> for connections. The return value is... |
Get the last date of each month in a list of dates in Python
Question: I'm using Python 2.7, PyCharm and Anaconda,
I have a `list` of dates and I'd like to retrieve the last date of each month
present in the array.
Are there any functions or libraries that could help me to do this?
I read the dates from a CSV file a... |
Eliminating warnings from scikit-learn
Question: I would like to ignore warnings from all packages when I am teaching, but
scikit-learn seems to work around the use of the `warnings` package to control
this. For example:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from... |
Python: Writing Counter to a csv file
Question: I have a csv file of data that has the columns `‘number’`, `’colour’`,
`’number2’`, `’foo’`, `’bar’`, which looks like:
12, red, 124, a, 15p
14, blue, 353, c, 7g
12, blue, 125, d, 65h
12, red, 124, c, 12d
I want to count the number of time... |
matplotlib pyplot show capture image
Question: In a python interactive session the following code is run:
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.show()
how do I let show() not block and not actually show the image, but instead
store it in a file? I can not change the code to ... |
Why does Python's print function act this way?
Question: I was writing a simple Hello World Python script and tried a couple different
things to see what I would get.
Results:
print "Hello World" ===> Hello World
print "Hello"," ","World ===> Hello World
print "Hello" "World" ===> Hell... |
How to loop sklearn linear regression by values within a column - python
Question: I am relatively new to python and programming in general.
I have a csv with three columns, an identifier, distance, and date. The data
looks something like:
id, date, distance
1, 1850, 150
1, 1950, 200
1,... |
Python 3, Tkinter, How to update button text
Question: Im trying to make it so that when the user clicks a button, it becomes "X" or
"0" (Depending on their team). How can I make it so that the text on the
button is updated? My best idea so far has been to delete the buttons then
print them again, but that only deletes... |
Pinging in Python with Feedback
Question: so I'm such a noob in Python it's painful but I'm trying to come up with a way
to PING a site, then spit out an 'if/else' clause.
So far I have this:
import subprocess
command = "ping -c 3 www.google.com" # the shell command
process = subprocess.Popen(... |
Weird behavior of T distribution
Question: I have an empirical distribution and I am trying to fit a `T` distribution to
it using `numpy` and plotting it with `matplotlib`.
Here is something I cannot understand:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import t
... |
Solving vector ordinary differential equations in python with scipy odeint
Question: I'm trying to solve and ode that involves vectors and can't come out with a
feasible answer. So i split it into 6 components, one for each time derivative
of a component, and one for each time derivative of a velocity component. The
fi... |
installing cdat-light with anacanda
Question: I'm trying to get cdat-light to use with Python (and the Anaconda package I
have downloaded). The procedure of insttaling cdat-lite with Anaconda is very
simple.
conda install -c <https://conda.binstar.org/scitools> cdat-lite
I am on CentOS (version 6.5) and have troubles... |
Error when config logging use logging.config.dictConfig in python
Question: First of all , I am using python.Try to config logging by a config json file
and use **logging.config.dictConfig()** .I used it before and it work well.
But this time I delete a little bit and some how it just doesn't work. My
config file will ... |
MemoryError in Python
Question: I have text file, its size is 300 MB. I want to read it and then print 50 most
frequently used words. When i run the program it gives me MemoryError. My code
is as under:-
import sys, string
import codecs
import re
from collections import Counter
import c... |
Python multiline regex from text to text MULTILINE
Question: I want to extract info from .cdp file ( content downloader file, program to
parsing, can be opened in notepad) file looks like:
....
...
<CD_PARSING_RB_9>0</CD_PARSING_RB_9>
<CD_PARSING_RB_F9_3>0</CD_PARSING_RB_F9_3>
<CD_PARSING... |
imports fail in subfolder
Question: I have a Python project, that uses some code from a Github repo. I added the
repo using `git submodule add`. So now I have the following file-structure:
ProjectFolder\
foo.py
BarProject\ (the Github repo added with submodule)
bar.py
... |
Maya Python Create and Use Zipped Package?
Question: Can anyone describe exactly how someone can create and execute a python zip
package in Maya? A lot of tutorials and questions regarding this jump into the
middle and assume certain knowledge. I need a simple example as a starting
point.
Folder/
... |
Pull out chunks of a plot made in python and re-display
Question: I have made a plot in jupyter that has an x-axis spanning for about 40
seconds. I want to pull out sections that are milliseconds long and re-display
them as separate plots (so that they can be better viewed). How would I go
about doing this?
Answer: Y... |
Error sorting in MongoDB
Question: Going through the Udacity course "Data Wrangling with MongoDB" and they have
the following question. I tried solving (as you see below). However, it's
giving me Python error and I am not sure what's wrong.
The format of JSON it's going on is this:
{
"_id" : Obj... |
Python Flask: keeping track of user sessions? How to get Session Cookie ID?
Question: I want to build a simple webapp as part of my learning activity. Webapp is
supposed to ask for user to input their email_id if it encounters a first time
visitor else it remembers the user through cookie and automatically logs
him/her... |
Aerospike losing documents when node goes down
Question: I've been doing dome tests using aerospike and I noticed a behavior different
than what is sold.
I have a cluster of 4 nodes running on AWS in the same AZ, the instances are
t2micro (1cpu, 1gb RAM, 25gb SSD) using the aws linux with the AMI aerospike
aerospike.... |
How many attempts do websocket-client's send() do?
Question: I use the Python package [websocket-
client](http://pypi.python.org/pypi/websocket-client/) to take care some
client-server discussion.
Assume I do the following:
import websocket
MAX_TIMEOUT = 1 * 60 # Maximum time to wait to establish t... |
How to scrape javascript webpage using python standard libs only
Question: I have to scrape a website that uses javascript to display content. I have to
use standard libs only as I will run this script on a server where there is
not any browser. I have found selenium but it requires a browser that in my
case is not pos... |
New python versions add to the existing ones, rather than upgrading
Question: I'm new to python. I installed python3.4 on OsX some time ago and now I
installed python3.5 using the installer you can download from the site.
I noticed that in /Library/Frameworks/Python.framework/Versions/ I have both
3.4 and 3.5. I wasn'... |
python, find and print specific cells in csv files that are in different directories
Question: I have different csv files in different directories. so i want to find
specific cells in different columns that correspond to a specific date in my
input.txt file. here is what i have until now:
import glob, os... |
Using a for loop in python to generate mySQL insert statements
Question: I am working on a python script to take an incoming String of data from
several arduinos to read, split and insert that data into a database.
The problem is the sensor data varies in the number of values depending on
what kind of sensor is used. ... |
class GzipFile(io.BufferedIOBase): AttributeError: 'module' object has no attribute 'BufferedIOBase' installing python tables
Question: I have a problem while installing python tables. There is something missing or
corrupt in my path or dependencies that I can not solve.
When I'm using a Python program that uses table... |
Parsing JSON array in Python to create a delimited string
Question: Brand new to Python and trying to parse a JSON array like the one below:
[
{"Event":"start","EventDateTime":"2015-09-15T03:45:16.681428Z"},
{"Event":"process","EventDateTime":"2015-09-15T03:45:16.681428Z"},
{"Event":"en... |
Python 3 Regex Issue
Question: Why does the following `string1` regexp not match? I have tested it using
[this](https://regex101.com/ "this") and it appears my regex-fu is accurate,
so I figure I must be missing something in the python implementation:
import re
pattern = r".*W([0-9]+(\.5)?)[^\.]?.*$"... |
Mongodb lock prevention
Question: After some time looking at the mongodb documentation and the pymongo API, I am
still no clearer on what route I take as the way forward (more confused now
that when I started) . My problem concerns locks ... not so much that I have
tested and found there to be major concurrency problem... |
Comparing first element of the consecutive lists of tuples in Python
Question: I have a list of tuples, each containing two elements. The first element of
few sublists is common. I want to compare the first element of these sublists
and append the second element in one lists. Here is my list:
myList=[(1,... |
Unable to fetch element using scrapy
Question: I have wrote a spider to scrap a few elements from a website but the problem
is i am unable to fetch some of the elements and some are working fine. Please
help me in right direction.
Here is my spider code:
from scrapy.selector import Selector
from scr... |
Runing module of python package
Question: I am trying to execute a package from github called
[plagcomps](https://github.com/NoahCarnahan/plagcomps)
I try to execute the extrinsic_testing module using the following command:
python -m plagcomps.extrinsic.extrinsic_testing
I get an error as follows:... |
Python lambda function printing <function <lambda> at 0x7fcbbc740668> instead of value
Question: I am a beginner in python, and I was playing around with lambda functions. I
was writing a program using lambda function to print characters that are +1
the ascii value of the input characters. My code is
#!/... |
Python zipfile module adds files with null bytes instead of correct content
Question: When I use `zipfile.ZipFile.writestr`, the file contains the correct amount of
characters afterwards, but all of them are null bytes.
Minimal example:
import zipfile
z=zipfile.ZipFile("test.zip", "w")
z.writest... |
redirect all requests from one domain to another with Google App Engine but keep static routing rules in yaml
Question: I have a GAE app serving static files defined by rules in the yaml file under
two different domain names as configured in DNS, an old one and a new one, but
otherwise it's the same content served for ... |
Python exception not caught
Question: I am currently playing with sockets and JSON in Python where I have the
following code:
class RCHandler(SocketServer.BaseRequestHandler):
def setup(self):
pass
def handle(self):
raw = self.request.recv(1024)
... |
Slate in Python stumbles on foothills
Question: Trying to parse PDFs into text and have been trying to start with Slate.
However, just following the basic example posted everywhere, I get the
following:
>>> import slate
>>> with open('pytest.PDF') as fp:
... doc = slate.PDF(fp)
...
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.