text stringlengths 226 34.5k |
|---|
Receiving and empty list when trying to make a webscraper to parse websites for links
Question: I was reading [this](http://docs.python-guide.org/en/latest/scenarios/scrape/)
website and learning how to make a webscraper with `lxml` and `Requests. This
is the webscraper code:
from lxml import html
im... |
activating virtualenv in windows which was created in ubuntu
Question: I created a `virtualenv` in ubuntu for one of my projects. Later I wanted to
use the same `virtualenv` in windows and tried activating it using only the
`activate` command
But the environment it activated had name `root` instead of the original o... |
Use module as class instance in Python
Question: ## TL; DR
Basically the question is about hiding from the user the fact that my modules
have class implementations so that the user can use the module as if it has
direct function definitions like `my_module.func()`
## Details
Suppose I have a module `my_module` and a... |
Only one usage of each socket address is normally permitted Python
Question: I wrote a basic program in to create a socket with a server and a client. But
the problem is that when I run the code, it gives me an error saying that only
one usage of each socket address is normally permitted. So I think the problem
is due ... |
Jupyter notebook and QT Console are calling different version of pandas
Question: QTConsole is running the latest version of pandas (i.e. 0.18). However, when I
import pandas in Jupyter notebook, it can only import 0.15. How can I resolve
this?
**QT Console:**
Jupyter QtConsole 4.2.0
Python ... |
Posting Request Data
Question: I am trying to post requests with Python to register an account.
It is not creating the account.
Any help would be great!
It has to accept the user's email and password and confirmation of their
password.
import requests
with requests.Session() as c:
url... |
matplotlib.pyplot errorbar ValueError depends on array length?
Question: Good afternoon.
I've been struggling with this for a while now, and although I can find
similiar problems online, nothing I found could really help me resolve it.
Starting with a standard data file (.csv or .txt, I tried both) containing
three c... |
"FailedParse: [...] Expecting end of text" when trying to parse parenthesized expressions in grako
Question: In `search_query.ebnf`, I have the following grammar definition for `grako`
3.14.0:
@@grammar :: SearchQuery
start = search_query $;
search_query = parenthesized_query | combined... |
phantomjs not loading instagram and pintersest webpages
Question: I'm using PhantomJS 2.1.1 in python 2.7.12 under Ubuntu Server 16.04.1, with
Display from pyvirtualdisplay
PhantomJS is unable to load instagram interactive dom pages
(<https://www.instagram.com/accounts/login/>). The page code should be within
... |
Importing Tensorflow Session Bundle in Python
Question: How do you import from inside Python a Tensorflow session bundle? The docs
explain [exporting from
Python](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/session_bundle#exporting-
python-code) and [importing in
C++](https://github.com/tens... |
Openshift python requests proxy permission denied
Question: I'm trying to use a proxy with the python 'requests' package on an Openshift
server. I am getting a permission denied error. See below.
Is Openshift blocking the connection or am I not configuring it correctly?
Something else? Openshift doesn't want to let me... |
error using Python Elasticserarch-py package
Question: So I am trying to create a connection to AWS ES. I have successfully connected
to my S3 bucket in the same zone. However, when I try to connect to ES, I get
this message every time.
Please install requests to use RequestsHttpConnection.
I have ... |
How to integrate a python program into a kivy app
Question: I'm working on an app written in python with the kivy modules to develop a
cross-platform app. Within this app I have a form which takes some numerical
values. I would like these numerical values to be passed to another python
program I've written, used to cal... |
Connecting to Azure SQL with Python
Question: I am trying to connect to a SQL Database hosted in Windows Azure through
MySQLdb with Python.
I keep getting an error mysql_exceptions.OperationalError: (2001, 'Bad
connection string.')
This information works when connecting through .NET (vb, C#) but I am
definitely not h... |
simple SNTP python script
Question: I need help to complete following script:
import socket
import struct
import sys
import time
NTP_SERVER = '0.uk.pool.ntp.org'
TIME1970 = 2208988800L
def sntp_client():
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... |
how to print json data
Question: I have following json file and python code and i need output example...
**json file**
{"b": [{"1": "add"},{"2": "act"}],
"p": [{"add": "added"},{"act": "acted"}],
"pp": [{"add": "added"},{"act": "acted"}],
"s": [{"add": "adds"},{"act": "acts"}],
"ing": [{... |
Easiest way to parallelise a call to map?
Question: Hey I have some code in Python which is basically a World Object with Player
objects. At one point the Players all get the state of the world and need to
return an action. The calculations the players do are independent and only use
the instance variables of the respe... |
unable to execute Celery beat the second time
Question: I am using Celery beat for getting the site data after every 10 seconds.
Therefore I update the settings in my Django project. I am using rabbitmq with
celery.
**settings.py**
# This is the settings file
# Rabbitmq configuration
BROKER_URL ... |
python : get list all *.txt files in a directory
Question: i'm beginner in python language
how to get list all `.txt` file in a directory in python language ?
for example get list file :
['1.txt','2.txt','3.txt','4.txt','5.txt','6.txt']
Answer: you can use `os`, `subprocess` and `glob` library
... |
gooey module not installing correctly
Question:
C:\Python34\Scripts>pip install Gooey
Collecting Gooey
Using cached Gooey-0.9.2.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Haesh... |
Read data from binary file python
Question: I have a binary file with this format:
[](http://i.stack.imgur.com/qHVBs.jpg)
and i use this code to open it:
import numpy as np
f = open("author_1", "r")
dt = np.dtype({'nam... |
How to find the source of global(ish) variable?
Question: I inherited some large and unwieldy python code. In one file its using a list
of commands imported from another file. Looking at it with pdb this commands
variable ends up in the global namespace. However there's another file that
doesn't look like its even bein... |
Python: Create a user and send email with account details to the user
Question: Here is a script I have written which will create a new user account. I am
trying to get help in adding a bit more to it.
I want to have it also send an email to the new user that is created. Ideally,
the program will ask the user creating... |
python scikit-learn TfidfVectorizer: why ValueError when input is 2 single-character strings?
Question: I am trying to run something like this:
from sklearn.feature_extraction.text import TfidfVectorizer
test_text = ["q", "r"]
vect = TfidfVectorizer(min_df=1,
... |
click on button to send adb commmand python
Question: I would like to build a program to send adb commannd to mobile when i click
the buttton, i tried with the following code but the command is not send to
device,I'm new in Python. Please can someone help me to solve this problem
from Tkinter import *
... |
parse table using beautifulsoup in python
Question: I want to traverse through each row and capture values of td.text. However
problem here is table does not have class. and all the td got same class name.
I want to traverse through each row and want following output:
1st row)"AMERICANS SOCCER CLUB","B11EB - AMERICANS... |
why output list is empty in my code in Python 2.7
Question: Using Python 2.7 and trying to do simple tokenization on UTF-8 encoded files.
The output of `a` seems a byte string, which is expected, since after
`tk[0].encode('utf-8')`, it converts from Python `unicode` type to `str/byte`.
My major confusion is why output ... |
Python CGI Script "Cannot allocate memory" Import Error
Question: I have a simple CGI script on a shared 64bit Ubuntu hosting environment.
#!/kunden/homepages/14/d156645139/htdocs/htdocs/anaconda2/bin/python
# -*- coding: UTF-8 -*-
import sys
import cgi
import cgitb
cgitb.enable(... |
Calling from the same class, why is one treated as bound method while the other plain function?
Question: I have the following code snippet in Python 3:
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy import Column, Integer, String, Unicode, UnicodeText
from sqlalchemy.ext.hy... |
Kivy - My ScrollView doesn't scroll
Question: I'm having problems in my Python application with Kivy library. In particular
I'm trying to create a scrollable list of elements in a TabbedPanelItem, but I
don't know why my list doesn't scroll.
Here is my kv file:
#:import sm kivy.uix.screenmanager
Scr... |
how to use an open file for reuse it in severals functions?
Question: I am a beginner in python and not completely bilingual, so I hope you
understand me. I'm trying to develop a code where anyone can open a file, in
order to display its contents in a graph matplotlib, to do this using a
function called `read_file()` w... |
Python debuggers not stepping into a coroutine?
Question: In the example below:
import asyncio
import ipdb
class EchoServerProtocol:
def connection_made(self, transport):
self.transport = transport
def datagram_received(self, data, addr):
message ... |
remove duplicate values from items in a dictionary in Python
Question: How can I check and remove duplicate values from items in a dictionary? I have
a large data set so I'm looking for an efficient method. The following is an
example of values in a dictionary that contains a duplicate:
'word': [('769817... |
Python - Function Calls involving Object Inheritance
Question: Suppose I have a parent class `foo` and an inheriting class `bar` defined as
such:
class foo(object):
def __init__(self, args):
for key in args.keys():
setattr(self, key, args[key])
self.subinit()
... |
'int' object has no attribute '__getitem__' on a non-integer object
Question: In looking at other answers to this issue I found that the object was usually
an integer so i constructed a simple example showing it is not and integer (or
so I think), **this code:**
import numpy as np
a=np.arange(2,10)
... |
How to automatically input using python Popen and return control to command line
Question: I have a question regarding subprocess.Popen .I'm calling a shell script and
provide fewinputs. After few inputs ,I want user running the python script to
input.
Is it possible to transfer control from Popen process to command l... |
Python Turtle - Is it possible to prevent the crash at the end
Question: this is my code. I am using the turtle module to just write some text on the
screen for a project for school. But whenever I do this, the program
crashes/stops responding and I was wondering if it is possible to prevent this
from happening.
... |
Edit list of entries using Python
Question: My script so far:
#DogReg v1.0
import time
Students = ['Mary', 'Matthew', 'Mark', 'Lianne' 'Spencer'
'John', 'Logan', 'Sam', 'Judy', 'Jc', 'Aj' ]
print("1. Add Student")
print("2. Delete Student")
print("3. Edit Student... |
Load Spark RDD to Neo4j in Python
Question: I am working on a project where I am using **Spark** for Data processing. My
data is now processed and I need to load the data into **Neo4j**. After
loading into Neo4j, I will be using that to showcase the results.
I wanted all the implementation to de done in **Python** Pro... |
Scraping issues on a specific website
Question: This is my first question on stack overflow so bear with me, please.
I am trying to download automatically (i.e. scrape) the text of some Italian
laws from the website: [http://www.normattiva.it/](http://www.normattiva.it)
I am using this code below (and similar permuta... |
Finding a sub string and deleting it using regex, python
Question: I have a data set which looks like thus,
"See the new #Gucci 5th Ave NY windows customized by @troubleandrew for the debut of the #GucciGhost collection."
"Before the #GucciGhost collection debuts tomorrow, read about the artist @trou... |
ImportError: No module named 'Crypto.HASH' but pycryto installed
Question: I am trying to load pycrypto module. When I do
import Crypto
I get no error but when I do from `Crypto.HASH import SHA256` , I am getting
`ImportError`
>>> import Crypto
>>> hash = SHA256.new()
Traceba... |
extract data from website using python
Question: I recently started learning python and one of the first projects I did was to
scrap updates from my son's classroom web page and send me notifications that
they updated the site. This turned out to be an easy project so I wanted to
expand on this and create a script that... |
ImportError: No module named durationfield.db.models.fields.duration (Python, Django 1.9)
Question: I'm trying to put a duration field in my models and I'm following the
instructions [here](https://django-durationfield.readthedocs.io/en/latest/).
First problems I run into is that I can't seem to import the module. Does... |
Python: Get Gmail server with smtplib never ends
Question: I simply tried:
>>> import smtplib
>>> server = smtplib.SMTP('smtp.gmail.com:587')
in my Python interpreter but the second statement never ends.
Can someone help?
Answer: You might find that you need a login and password as a prerequ... |
How to tell that string is a json?
Question: I have a string that I pull from a REST API that is actually a JSON.
I can't use `req.json()` as python doesn't format json correctly i.e. it is
using single quotes and not double quotes, plus it puts a unicode symbol where
there shouldn't be one. This means I can't use it ... |
conversion of np.array(dtype='str') in an np.array(dtype='datetime')
Question: I have a very simple python question. I need to transform the string values
within an np.array into datetime values. The string values contain the
following format: ('%Y%m%d'). Does any one know how to this? Here my test
data:
... |
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TAB LESPACE, but settings are not configured
Question: I’m using Django 1.9.1 with Python 3.5.2 and I'm having a problem running a
Python script that uses Django models.
C:\Users\admin\trailers>python load_from_api.py
Traceb... |
Special characters/kanji problems using Python unicode
Question: I want to use videofileclip(), but a UnicodeDecodeError occurs. The videofiles
include japanese kanji or special characters.
My example code:
#-*- coding: utf-8 -*-
import sys
from moviepy.editor import VideoFileClip
rel... |
cant call curl from python3
Question: I am trying to call this `curl` from `python3`. This, from `bash`, is working
fine.
curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1103/PhysRevLett.117.126802
yielding the expected result:
@article{Chang_2016, title={Obs... |
Python how cyclic fetch a pre-fixed number of elements in array
Question: I'm trying to make a function that will always return me a pre-fixed number of
elements from an array which will be larger than the pre-fixed number:
def getElements(i,arr,size=10):
return cyclic array return
where `i... |
How to get rid of row numbers, pd.read_excel?
Question: I am a complete beginner with Python. I am working on a assignment and I can't
seem to figure out how to get rid of the _row numbers_ from my excel
spreadsheet, while using `import pandas`.
This is what I get when I run the code:
0 $20,000,000 $1... |
Camera calibration for Structure from Motion with OpenCV (Python)
Question: I want to calibrate a car video recorder and use it for 3D reconstruction with
Structure from Motion (SfM). The original size of the pictures I have took
with this camera is 1920x1080. Basically, I have been using the source code
from the [Open... |
Can I run Numpy (or other Python packages) on Android?
Question: I have implemented a python script, which imports Numpy and Pandas and I would
like to run this script on Android. To be more precise, I would like to embed
this script into an application.
I would like to know whether it is possible? If so, what are th... |
Unable to Install Python Package
Question: In trying to install a python package via pip I get the error:
Failed building wheel for atari-py
Running setup.py clean for atari-py
Failed to build atari-py
Installing collected packages: atari-py, PyOpenGL
Running setup.py install for at... |
How to download this GIF(dynamic) by Python?
Question: I give an url as example:
http://ww4.sinaimg.cn/large/a7bf601fjw1f7jsbj34a1g20kc0bdnph.gif
You can see it in your browser.
Now I want to download it. I **have tried** :
1.
`urllib.urlretrieve(imgurl,filepath')`
failed, got an "error" pictur... |
Substitute Function call with sympy
Question: I want to receive input from a user, parse it, then perform some substitutions
on the resulting expression. I know that I can use
`sympy.parsing.sympy_parser.parse_expr` to parse arbitrary input from the
user. However, I am having trouble substituting in function definition... |
How to use libraries, running at docker
Question: Can anybody, please, explain me, how to use a library, which image's running
at docker? And how the process is constructed in genereal: how python access
the image or vice-versa( i mean, its not in the "lib" folder in python,
right?)? And simply, what should i do, to be... |
Need a way to test SSH with a timeout
Question: This is my current code to test if a host is SSH-able. It works just fine when
the host is up with or without SSH service running. However, it seems to just
hang when the host crashes, which is the unique usecase that I need to depend
on it giving me a quick True/False re... |
Why isn't this element visible (Selenium + Python/Django 1.9)
Question: I am using webdriver to fill out a form in Django. The first field, name, is
found and filled out. But the second field is somehow not being found. Here's
the script I'm using...
name = browser.find_element_by_id("name")
value = ... |
Python 3 Regex and Unicode Emotes
Question: Using Python 3, a simple script like the following should run as intended, but
appears to choke on unicode emote strings:
import re
phrase = "(╯°□°)╯ ︵ ┻━┻"
pattern = r'\b{0}\b'.format(phrase)
text = "The quick brown fox got tired of jumpi... |
Python setting global variables in different ways in 2.7
Question: I was trying to practice a concept related to setting global variables using
diff methods , but the following example is not working as per my
understanding .
#Scope.py
import os
x = 'mod'
def f1() :
... |
Can variables in a function for later use?
Question: Can Python store variables in a function for later use?
This is a stat calculator below (unfinished):
#Statistics Calculator
import random
def main(mod):
print ''
if (mod == '1'):
print 'Mode 1 activated'
... |
python django run bash script in server
Question: I would like to create a website-app to run a bash script located in a server.
Basically I want this website for:
* Upload a file
* select some parameters
* Run a bash script taking the input file and the parameters
* Download the results
I know you can do thi... |
python - import namespace
Question: If I have a library like:
MyPackage:
* `__init__.py`
* SubPackage1
* `__init__.py`
* moduleA.py
* moduleB.py
* SubPackage2
* `__init__.py`
* moduleC.py
* moduleD.py
But I want that users can import moduleA like `import MyPackage.moduleA`
directly.... |
How to perform input redirection in python like the bash >?
Question: I want to feed text files to a C program, with bash I can do `./prog <file`,
how would you do the same in python ?
Answer: You can do that via
[`subprocess.check_call`](https://docs.python.org/3/library/subprocess.html#subprocess.check_call):
... |
Python - download video from indirect url
Question: I have a link like this
https://r9---sn-4g57knle.googlevideo.com/videoplayback?id=10bc30daeba89d81&itag=22&source=picasa&begin=0&requiressl=yes&mm=30&mn=sn-4g57knle&ms=nxu&mv=m&nh=IgpwcjA0LmZyYTE2KgkxMjcuMC4wLjE&pl=19&sc=yes&mime=video/mp4&lmt=143959737... |
why two points can't show in the figure (matplotlib)?
Question: Figure1 show data points[1](http://i.stack.imgur.com/j7b9r.png)
[1](http://i.stack.imgur.com/j7b9r.png):[](http://i.stack.imgur.com/j7b9r.png)
I drawed the figure by matplotlib in python,... |
Python: Counting words from a given file starting with 'L'
Question: I am new to python.I want to know how to count the number of words **starting
with a particular letter say 'L'** from a text file.
Answer: [str.startswith(prefix[, start[,
end]])](https://docs.python.org/2/library/stdtypes.html)
Give this a shot bu... |
np arrays being immutable - "assignment destination is read-only"
Question: FD** - I am a Python newb as well as a stack overflow newb as you can tell. I
have edited the question based on comments.
My goal is to read a set of PNG files, create Image(s) with
Image.open('filename') and convert them to simple 2D arrays w... |
Python: Does 'kron' create sparse matrix when I use ' from scipy.sparse import * '?
Question: For the code below, Mat is a array-type matrix,
a = kron(Mat,ones((8,1)))
b = a.flatten()
If I don't import scipy.sparse package, `a` is an **array-type matrix** , `b`
can also be executed. If I use 'f... |
Anaconda install pyipopt: libipopt.so.1
Question: I'm completely new to Python and most aspects of compiling C.
My default python interpreter is the anaconda interpreter for python 2.7. I'm
trying to install pyipopt following these instructions:
<https://github.com/xuy/pyipopt>. Pyipopt installed to
`/usr/local/lib/py... |
Python program using class programs to simulate the roll of two dice
Question: My program is supposed to simulate to both simulate the role of a single dice
and the role of two dices but I am having issues. Here is what my code looks
like:
import random
#Dice class simulates both a single and tw... |
Comments not showing in post_detail view
Question: I am doing a project in django 1.9.9/python 3.5, for exercise reasons I have a
blog app, an articles app and a comments app. Comments app has to be genericly
related to blog and articles. My problem is that the templates are not showing
my comments. Comments are being ... |
Python Class instance variables printing out as tuples instead of string
Question: I am creating the following `class` within python. But when I create an
instance of the `class` and print out the `imdb_id` value. It prints it as a
_tuple_.
What am I doing wrong? I would like it to simply print out the _string_.
... |
Usefullness of one-line statements in Python
Question: Is using one line loops, even nested loops always a good practice in Python? I
see a lot of people just love "one-liners", but to me they're hard to read
sometimes, especially if we're talking about nested loops.
Moreover most of nested loops I've seen so far exce... |
How to deal with Python long import
Question: This is about python long import like this:
from aaa.bbb.ccc.ddd.eee.fff.ggg.hhh.iii.jjj.kkk.lll.mmm.nnn.ooo import xxx
The length between 'from' and 'import' is already above than 80 characters, is
there any better pythonic ways to deal with it?
Answer: You can always ... |
DES in python can't get the correct encoded data using pycrypto
Question: I hava a algorithm to encrypt data in java ,I want to rewrite it in python.But
the two algorithm can't get the same encoded data. java code is :
String strDefaultKey = "QabC-+50";
Key key = new SecretKeySpec(strDefaultKey.getBy... |
Simple Python web crawler
Question: I'm following a python tutorial on youtube and got up to where we make a basic
web crawler. I tried making my own to do a very simple task. Go to my cities
car section on craigslist and print the title/link of every entry, and jump to
the next page and repeat if needed. It works for ... |
Error when trying to install PyCrypto
Question: I'm using Mac with latest OS X update. I've trying to install PyCrypto over
Terminal but I'm getting error which is shown on image below. The command I
used is `sudo pip install pycrypto`. Can you please help me with this issue?
How do I resolve this? Thanks for your answ... |
Preventing fedora from installing mariadb
Question: I'm running Fedora 24, with kde plasma, having recently decided to try it
after mostly being on Ubuntu.
This morning while trying to update, I ran into a conflict between mariadb and
percona. I had installed percona from rpms (since I couldn't install 5.7 from
repos)... |
how to make logging.logger to behave like print
Question: Let's say I got this
[logging.logger](https://docs.python.org/2/library/logging.html) instance:
import logging
logger = logging.getLogger('root')
FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
logging.basicConfig(... |
Using arg parser in python in another class
Question: I'm trying to write a test in Selenium using python,
I managed to run the test and it passed, But now I want add arg parser so I
can give the test a different URL as an argument.
The thing is that my test is inside a class, So when I'm passing the argument
I get a... |
python def creation within a .py
Question: I am trying to create a def file within a py file that is external eg.
`calls.py`:
def printbluewhale():
whale = animalia.whale("Chordata",
"",
"Mammalia",
"Certariodactyla",
... |
How to partially remove content from cell in a dataframe using Python
Question: I have the following dataframe:
import pandas as pd
df = pd.DataFrame([
['\nSOVAT\n', 'DVR', 'MEA', '\n195\n'],
['PINCO\nGALLO ', 'DVR', 'MEA\n', '195'],
])
which looks like this:... |
Acessing a variable as a string in a module
Question: Following other posts here, I have a function that prints out information
about a variable based on its name. I would like to move it into a module.
#python 2.7
import numpy as np
def oshape(name):
#output the name, type and shape/leng... |
Replace newline in python when reading line for line
Question: I am trying to do a simple parsing on a text in python which I have no issues
with in bash using tr '\n' ' '. Basically to get all of the lines on a single
line. In python print line is a bit different from what I understand. re.sub
cannot find my new line ... |
Raspberry LCD IP display format
Question: I'm working on a little project with a Raspberry Pi, and I need to display the
IP adress of the PI on an LCD screen.
I followed this tutorial : <https://learn.adafruit.com/drive-a-16x2-lcd-
directly-with-a-raspberry-pi/python-code>
It seems to work fine, however there is a pr... |
python ImportError: No module named cy_unity graphlab
Question: I am new to python and I am trying to work on a project with deep learning and
want to use graphlab library. I use sublime text for coding on windows 10. My
code is only this line:
`import graphlab`
I get this error msg:
Traceback (most recent call last... |
Align ListBox in Frame wxpython
Question: I'm trying to figure out how to align a ListBox properly. As soon as i insert
the lines of ListBox, the layout transforms into a mess.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wx
oplist=[]
with open("options.txt","r") as f:
fo... |
Python ImageIO Gif Set Delay Between Frames
Question: I am using ImageIO: <https://imageio.readthedocs.io/en/latest/userapi.html> ,
and I want to know how to set delay between frames in a gif.
Here are the relevant parts of my code.
import imageio
. . .
imageio.mimsave(args.output + '.gif', AR... |
Insert python variable value into SQL table
Question: I have a password system that stores the password for a python program in an
SQL table. I want the user to be able to change the password in a tkinter
window but I am not sure how to use the value of a python variable as the
value for the SQL table. Here is a sample... |
Checksum for a list of numbers
Question: I have a large number of lists of integers. I want to check if any of the
lists are duplicates. I was thinking a good way of doing this would be to
calculate a basic checksum, then only doing an element by element check if the
checksums coincide. But I can't find a checksum algo... |
How many FLOPs are there in calculating a factorial using math.factorial(n) in python
Question: I am trying to understand how many FLOPs are there if I use a certain
algorithm to find the exponential approximated sum, specially If I use
math.factorial(n) in python. I understand FLOPs for binary operation, so is
factori... |
django celery unit tests with pycharm 'No module named celery'
Question: my tests work fine when my target is a single function (see 'Target' field in
the image):
questionator.test_mturk_views.TestReport.submit
However, when I specify my target to include all tests within my questionator
app:
... |
Should I notify while holding the lock on a condition or after releasing it?
Question: The [Python `threading`
documentation](https://docs.python.org/3/library/threading.html) lists the
following example of a producer:
from threading import Condition
cv = Condition()
# Produce one item
w... |
importing ecoinvent 3.2 with brightway
Question: I am having some trouble importing Ecoinvent 3.2 with Brightway2, I was
following the [example
notebook](http://nbviewer.jupyter.org/urls/bitbucket.org/cmutel/brightway2/raw/default/notebooks/IO%20-%20importing%20Ecoinvent.ipynb):
from brightway2 import *
... |
Package version difference between pip and OS?
Question: I have Debian OS and python version 2.7 installed on it. But I have a strange
issue about package `six`. I want to use 1.10 version.
I have installed six 1.10 via pip:
$ pip list
...
six (1.10.0)
But when I run the following script
... |
Python CSV: Can I do this with one 'with open' instead of two?
Question: I am a noobie.
I have written a couple of scripts to modify CSV files I work with.
The scripts:
1.) change the headers of a CSV file then save that to a new CSV file,.
2.) Load that CSV File, and change the order of select columns using
DictWr... |
Not getting required output using findall in python
Question: Earlier ,I could not put the exact question.My apologies.
Below is what I am looking for :
I am reading a string from file as below and there can be multiple such kind
of strings in the file.
" VEGETABLE 1
POTATOE_PRODUCE 1.1 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.