text stringlengths 226 34.5k |
|---|
Logging script data with Node child_process
Question: I am working with a python script that runs on a loop and outputs a new value
every second, and can only be stopped by pressing `enter` on the keyboard. For
various reasons, the python code should not be altered.
**Ask:** How do I capture the first ten values of th... |
python to search within pdf file
Question: here is part of pdf structure:
5 0 obj
<< /Length 56 >>
stream
BT /F1 12 Tf 100 700 Td 15 TL (JavaScript example) Tj ET
endstream
endobj
6 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encodi... |
How to open a text file with python
Question: I would like to open a file that contains text. I would like the text file to
open up with a program called gedit, and the filename is entry3. Gedit is just
a type of text editor.
Answer:
import subprocess
subprocess.call(("gedit", "entry3"))
|
python utc time minus 5 minutes
Question: How to round down a time 5 minutes in Python?
I have this script, but i think this can be easyer, and the full hours the
calculation goes wrong. When its 22:03 it returns 21:95 instead of 21:55.
import datetime
from datetime import date
import time
... |
interp function in python like matlab
Question: Could someone explain how to use an interpolation function on an existing
array, in python as the one exists in matlab ?
example:
x =
1
2
3
4
5
6
7
8
9
10
> > interp(x,2)
ans =
1.0000
... |
How to detect what output is and do if statement from it?
Question: Basically I am writing a script in Python that will check for me the status of
my servers. I need it to ping five different IPs and then detect what the
output is. I will then need an if statement for example:
import.os
Server1 = os.... |
online web form access using python
Question: I am trying to access websites that require login information. For practice I
tried getting into Hotmail just to see if it would work. I have no idea if
this code is right. With trial and error I have the code "running", but it
isn't working still.. Can someone help me out?... |
Match any word in string except those preceded by a curly brace in python
Question: I have a string like
line = u'I need to match the whole line except for {thisword for example'
I have a difficulty doing this. What I've tried and it doesn't work:
# in general case there will be Unic... |
How to convert a '\u5f71\u89c6\...' in to its real meaning?(python)
Question: I want to convert
'[["[FK\u5f71\u89c6\u51fa\u54c1]\u7576\u65fa\u7238\u7238-17.\u7ca4\u8bed\u5b57\u5e55.TV-RMVB.rmvb", "205.53 MB"]]'
to
'[["[[FK影视出品]當旺爸爸-17.粤语字幕.TV-RMVB.rmvb", "205.53 MB"]]'
Because ... |
Distributed lock manager for Python
Question: I have a bunch of servers with multiple instances accessing a resource that
has a hard limit on requests per second.
I need a mechanism to lock the access on this resource for all servers and
instances that are running.
There is a restful distributed lock manager I found ... |
Accessing python list in javascript as an array
Question: I have this in my flask views.py
def showpage():
...
test = [1,2,3,4,5,6]
return render_template("sample.html",test=test)
I have this in my sample .html
<script> var counts = {{test}}; </s... |
Using files in Hadoop Streaming with Python
Question: I am completely new to Hadoop and MapReduce and am trying to work my way
through it. I am trying to develop a mapreduce application in python, in which
I use data from 2 .CSV files. I am just reading the two files in mapper and
then printing the key value pair from ... |
Python datastructures into js datastructures using jinja2 template (lists and dicts)
Question: I have a very similar problem to this question, [Python datastructures into js
datastructures using Django templates (lists and
dicts)](http://stackoverflow.com/questions/9547185/python-datastructures-into-
js-datastructures-... |
TypError when save function of Pillow called. Too many arguments
Question: Attempting to call the save function results in a TypeError. As a side note:
qrcode requires the importing of PIL as PilImage.
It's also worth mentioning that I did not have this error when using the
Python Imaging Library. It only occurred aft... |
uWSGI unique timer python decorator
Question: I would like to run a cron-like command with python decorators that needs to
be unique (so that if the previous process is still running it doesn't start a
new process) with uwsgi.
taking a look at the documentation (<http://uwsgi-
docs.readthedocs.org/en/latest/PythonDeco... |
how to send email attachement using python 2.7
Question: I am getting error when using this code to send email using localhost ip, any
suggestion how to solve the socket error?
def SendTMail(self):
# Import the email modules we'll need
# Open a plain text file for reading. For this example,... |
rrdscript won't plot anything
Question: Hey guys (and off course Ladys) ,
i have this little script which should show me some nice rrd graphs. But i
seems like i cant find a way to bring it to work to show me some stats. This
is my Script:
# Function: Simple ping plotter for rrd
import rrdtool,tempf... |
UTF-8 "inconsistency" when storing unicode key/values from CSV file into dict
Question: I always get very confused when dealing with Unicode and UTF-8 characters and
encodings in Python. There's probably a simple explanation to what I'm going
to detail below, but, so far, I can't wrap my head around it.
Let's say I ha... |
How to fit a model to my testing set in statsmodels (python)
Question: I am working on a logistic regression model and I am having trouble
understanding how to take the model fit from my training set onto my testing
set. Sorry, I am new to python and VERY new to statsmodels..
import pandas as pd
impo... |
Is there a way to map GAE user object and Google+ userid
Question: As mentioned
[here](https://developers.google.com/appengine/docs/python/users/loginurls),
for default authentication using python users API an object will be returned
based on user's email. When `user_id()` is called over the object a unique id
is retur... |
Execute a python separate application in a java application
Question: I have a small java project which do several activities including a database
update and i have a separate python(.py) application which update the same
database after a data mining process. In my Java application i need to
open(execute) my python app... |
Applying variable transparency to an image in java
Question: I'm wondering how to apply a variable mask to an image's transparency in Java
(presumably using buffered image). So, for instance, I want to apply a mask
such as the following:

To the an image such as the followin... |
Does the SVM in sklearn support incremental (online) learning?
Question: I am currently in the process of designing a recommender system for text
articles (a binary case of 'interesting' or 'not interesting'). One of my
specifications is that it should continuously update to changing trends.
From what I can tell, the ... |
installing lxml in OSX 10.9
Question: I have a problem installing the `lxml` in my mavericks machine.
I tried all possibilities by installing the prebuild binaries using
* normal pip
* pip with `static deps`
and Building
* Current version in normal model
* Current version with static deps
* Older version ... |
Does python make a copy of opened files in memory?
Question: So I would like to search for filenames with os.walk() and write the resulting
list of names to a file. I would like to know what is more efficient : opening
the file and then writing each result as I find them or storing everything in
a list and then writing... |
plotting dynamic data using matplotlib
Question: I'm writing an application do display data that changes dynamically (the data
being read from a socket).
As a dummy case, I try to draw a sine with an amplitude multiplied by 1.1 each
second:
import numpy as np
import matplotlib.pyplot as plt
impo... |
JSON to CSV in python convert issue
Question: I am trying to convert a nested JSON object file into CSV. Here is the sample
of JSON
{
"total_hosts" : [
{
"TYPE" : "AGENT",
"COUNT" : 6
}
],
"installed" : [
{
"ID" : "... |
Apache Benchmark horror results with a simple Gevent app
Question: I have a simple Python code to run Gevent.
Tested with Apache Benchmark with 10000 users and 5 concurrent but it's damn
slow..nearly 2 seconds per request (1.419 ms) which is bad..
My code is
from gevent import wsgi, monkey
cla... |
How do I show a Test_Question (String) per page?? (PyQt/Python)
Question: I am creating a PyQt application which creates and sets tests for the user.
However, when setting the test questions i wanted 1 question to be viewed per
page. For example, if the user was to start a test, then a question would
appear. Once they ... |
what is a way to ask in python if a number actually exists and is not masked in python
Question: I have an numpy array with 13 invalid (logs of zeros) numbers that I have
masked and 3 valid numbers:
[[-- -- -- --]
[-- -- 0.0 0.3010299956639812]
[-- -- -- 0.0]
[-- -- -- --]]
I wan... |
Python Subprocess Finishes, but Output File Not Available
Question: My python code is using a subprocess to call "ifconfig" through the shell and
uses ">" to write the output to a text file. When the subprocess finishes, and
returns success, I read the output file. I do this at fixed intervals to
monitor the network st... |
Super basic uwsgi configuration
Question: I've tried some uwsgi tutorials but can't get a simple python script to run in
my browser. Ive read through this (<http://uwsgi-
docs.readthedocs.org/en/latest/WSGIquickstart.html>) and this
(<https://www.digitalocean.com/community/articles/how-to-deploy-python-wsgi-
applicatio... |
Python MySQL insert and retrieve a list in Blob
Question: I'm trying to insert a list of element into a MySQL database (into a Blob
column). This is an example of my code is:
myList = [1345,22,3,4,5]
myListString = str(myList)
myQuery = 'INSERT INTO table (blobData) VALUES (%s)'
cursor.execut... |
Installing Swampy for Python 2.7 Help Please
Question: I've been trying to do this for 3 hours. I have windows. I'm using [this
official guide](http://www.greenteapress.com/thinkpython/swampy/install.html):
So for step 2 for the windows installation for Python 2: it says: "To see if
you have Tkinter, launch python; th... |
Pie chart labels are overlapping for same values.
Question: Here I'm trying to create a pie chart using **matplotlib** python library. But
the dates are overlapping if the values are same "0.0" multiple times.
My question is how I can display them separately.
Thanks.
:
def __init__(self, master):
Frame.__init__(self, master)
self.grid() #put it on the grid
self.create... |
python struct pack speed up inside function
Question: I'm testing python's struct pack/unpack performance and notice it'll speed up
if put inside a function:
import time
import struct
from io import BytesIO
def pack(b):
for i in range(10000000):
b.write(struct.pack('!... |
import from views.py does not work from app
Question: I'm working with django and I'm trying to get a simple app functional.
The app is supposed to deliver a simple 'Hello world'-view but my_app/urls.py
fails to import methods from my_app/views.py.
my app is named SocialUrl
Here is my-project/urls.py.
... |
Python mechanize saying existing control does not exist
Question: I am trying to scrape a password protected website in python. My code is as
follows:
import mechanize
import cookielib
from BeautifulSoup import BeautifulSoup
br = mechanize.Browser()
cj = cookielib.LWPCookieJar()... |
check if a number ends up with either XX,5 or is an integer in python
Question: I can solve it using multiple ifs and right function... but was wondering if
there were a nicer solution...
as an example
10,5 would return true
10 would return true
9,3 would return false
9,5 would return true
... |
How do you iterate through a gzipped carriage-return file using python 2.7?
Question: I have to use python 2.7 because I'm using the boto library and boto3 is
experimental. I need to read a file that is gzipped and lines are terminated
by carriage returns. Using [python
3.3](https://docs.python.org/3.3/library/gzip.htm... |
Trying to parse JSON data with python
Question: I am having no luck trying to parse this json data, i only care about a small
amount of it.
json data
{
"timestamp" : 1397555135361,
"sets" : {
"worldguard.markerset" : {
"areas" : {
"world_re... |
Opening/reading a list of unknown files using I/O methods
Question: So I'm a newb :) Python question
I have a list of files and I'm looking to open/read these files using an I/O
method
I understand if I explicitly go through each test file I've created and
opening them one by one would be fine but how about if I have... |
matplotlib says it needs libpng15, but I have libpng16
Question: The problem is likely a configuration issue, because getting the installation
correct on Macs seems to be tricky. I'm running Mavericks and matplotlib
1.4.x, yet when I open a Python 2.7.5 shell and `import pylib`, I get this
error:
>>> imp... |
Data extraction and transform efficiency
Question: I've got a Python script that connects to a MySQL database and executes a
number of nested SELECT queries. It's basically a giant for loop. The database
is structured such that Businesses have Menus, Menus have Sections, and
Sections have Items. The script queries all ... |
Add meta tag using BeautifulSoup
Question: How to add a meta tag just after title tag in a HTML page by using Beautiful
Soup(library). I am using python language for coding and unable to do this.
Answer: Use `soup.create_tag()` to create a new `<meta>` tag, set attributes on that
and add it to your document `<head>`.... |
Solve seemingly (but not actually!) overdetermined sparse linear system in Python
Question: I have a sparse matrix A (using scipy.sparse) and a vector b, and want to
solve Ax = b for x. A has more rows than columns, so it appears to be
overdetermined; however, the rows of A are linearly dependent, so that in
actuality ... |
Measuring runtime of CUDA through an script in python
Question: I am trying to use some profiling tools on CUDA with so many different inputs
to see the the differences among different inputs. For this purpose I wrote a
python script to compile the code on CUDA, run the profiler with different
inputs and write the resu... |
Python constants
Question: I am in the middle of a development in Django and we got some doubts about if
we should use or not constants in the project. Exactly the situation is to use
constants everywhere or not (we know constants in Django are not really read-
only).
There are 2 scenarios and I would like to get your... |
Pandas DataFrame stored list as string: How to convert back to list?
Question: I have an _n_ -by-_m_ Pandas DataFrame `df` defined as follows. (I know this
is not the best way to do it. It makes sense for what I'm trying to do in my
actual code, but that would be TMI for this post so just take my word that
this approac... |
Single mouse click within While loop (PsychoPy)
Question: I am using PsychoPy and I would like to print the position of my mouse when it
has been clicked.
The actual printing of the position needs to be placed inside a while loop.
Using the code below, when I click I get more than one output lines, which
print the sam... |
Adding a timestamp to a file, python subprocess linux
Question: I’m trying to take a picture with my `Raspicam` on my raspberry and adding a
`timestamp` too each picture. The code that I use doesn’t however work. It
gives me a syntax error at `.."+%H...` I have mucked around in the code and
was able too do it once, the... |
Start daemon process within BaseHTTPServer
Question: In order to allow helpdesk to restart an Oracle Instance, we are trying to
implement a small python webserver that would start a shell script that starts
the Oracle instance.
The code is done and it starts the instance but there is a problem: the
instance is connect... |
How to identify a specific switch in Mininet when connected to a pox controller
Question: I have a custom topology running on Mininet and it has 2 switches s1, and s2.
I am using pox as the controller. I have written a python code to identify the
switches, is this the correct way to do it? Are there any other better me... |
Algorithm to find the least difference between lists
Question: I have been trying to understand the algorithm used
[here](https://github.com/stefankoegl/python-json-
patch/blob/master/jsonpatch.py#L611) to compare two lists, implemented in this
[commit](https://github.com/stefankoegl/python-json-
patch/commit/cc7bda313... |
How to use MFDataset to read multiple files in OPeNDAP dataset with Python NetCDF4 module?
Question: I have an opendap thredds link to a directory holding many oceanographic model
output files from the Delaware Operational Forecast System (DBOFS). Historical
data are stored in separate hourly files and even some files ... |
How do I properly construct an UPDATE statement that references an attached database table?
Question: this question pertains to Python3's sqlite3 module (DB-API 2.0 interface for
SQLite databases).
I am trying to update a sqlite3 database column where there are equivalent
values in an attached database table. I fail t... |
Python to Ruby: How do I open a file, parse the data and multithread with it?
Question: I need to translate this into Ruby:
ids = [i.strip() for i in open('ids.txt','r')]
proxies = [i.strip() for i in open('socks.txt','r')]
for (i,j) in izip(ids,proxies):
i = parseID(i)
j = j.spli... |
Accessing ndarray and discarding invalid positions - Python
Question: I have one question about accessing a matrix position that in fact does not
exists.
First, I have an matrix with **rows** rows and **cols** columns. From this
matrix, I have to get sets of **n** x **n** sub matrices. For example, to get
3 x 3 sub ma... |
How to get data from MongoDB on client side using javascript/jQuery
Question: I have written a code in bottle in python which gets data from mongodb and
when the user request the url `http://localhost:8080/index/test` from bottle
it will return the json result from mongoDB. it works fine when I point my
browser to that... |
How can we remove all distinct words of length 16 letters or more using python
Question: How can we remove all distinct words of length 16 letters or more. Reduce the
size of these words to fifteen letters while keeping them distinct. (hint
removing postfix, suffix, and or infix)
so far i have done the following code:... |
Unhandled exception at multiarray.pyd the 2nd time the program runs
Question: I'm making a .dll plug-in in c++ and embedding python 2.7 in it.
Everything worked fine with simple .py programs until I imported a large
program. The strangest thing is that the program runs with no problem the
first time, but the second ti... |
Why is Julia slow when decoding GZIP and parsing JSON?
Question: The following script reads the gzip file line-by-line and decodes JSON object
Pkg.add("GZip")
Pkg.add("JSON")
using GZip
using JSON
stream = GZip.gzopen(Base.ARGS[1])
_started = time()
i = 0
... |
Is twitter-text-python thread-safe?
Question: I'm using [twitter-text-python](https://github.com/ianozsvald/twitter-text-
python)
Is it thread-safe to create an instance of Parser:
from ttp import ttp
parser = ttp.Parser()
and then use it in various threads?
Answer: I took a quick look at th... |
WARNING:base_connection:Unknown state on disconnect: 0 Pika/Celery/Rabbitmq
Question: I'm trying to run the hello world version of using celery/rabbitmq (from
rabbitmq site).
When I run `python send.py` it outputs this and throws an error:
python send.py
[x] Sent 'Hello World!'
WARNING:pika.ada... |
wxPython Reload a grid in a panel
Question: I've got several classes so I prefer not to paste any code here (if that's
possible :P)
The problem: I've created a class which creates a frame, and this frame
contains a panel. In another class I've stored all my settings.
On the panel are several sizers and among other at... |
Having trouble trying to pull data from a url into python using an API
Question: I'm trying to pull data from a chart on a site in csv format. I've tried
different combinations of code but can't seem to figure it out. I keep getting
the following errors depending on the code I write:
TypeError: 'set' object is not sub... |
Inserting JSON Data into SQL Server with Python
Question: I have a python script that makes a call to an API, submits a request, and
then is supposed to insert the result into a Sql Server 2012 table. When it
goes to execute the insert into SQL, it breaks. I am currently importing json,
requests, and pyodbc into the fi... |
Matplotlib interactive mode not working on win 7
Question: This file should work, but it doesn't:
from matplotlib import pyplot
pyplot.ion()
pyplot.plot(range(10))
raw_input('Press return to close')
The plot window appears, the inside is white and the hourglass cursor is
shown... |
Cython+NumPy - compiler not using numpy.pyd
Question: I have a code that uses numpy and I want to compile it using Cython. I added
the cimport directive:
import numpy as np
cimport numpy as np
I am on Windows 7, compiling using distutils with gcc (MinGW) as the compiler.
It yields an error when... |
formatting strings in list of lists
Question: I have this list of list
a = [['c', '1.3e-8', '4.5e-8'], ['h', '3.4e-5', '2.3e-7', '2.3e-5']]
I want to format the 'e' strings only as
a = [[ 'c', '0.000000013', '0.000000045'], ['h', '0.000034', '0.00000023', '0.000023']]
How can I... |
Could not extract TIF.gz file
Question: The TIF.gz file downloaded from the link below can be successfully extracted
by WinRAR GUI mode manually.
<ftp://ftp.glcf.umd.edu/glcf/QuickBird/02AUG15032744-X2AS_R1C1-000000185959_01_P005-Indonesia-
Ujong/02AUG15032744-M2AS_R1C1-000000185959_01_P005.TIF.gz>
However, it could ... |
Python: tkinter, adding entry to listbox doesn't response
Question: For some reason, it doesn't add the element to the listbox. I guess it's
because of the program order, but i'm not sure how should I properly put the
code in the right order
Here is the code:
from tkinter import *
class App(Fra... |
Read the data of a single channel from a stereo wave file in Python
Question: I have to read the data from just one channel in a stereo wave file in Python.
For this I tried it with scipy.io:
import scipy.io.wavfile as wf
import numpy
def read(path):
data = wf.read(path)
for ... |
TypeError: super(type, obj) when running pyprocessing script interactively
Question: Python 2.7.3:
Create the simplest possible
[`pyprocessing`](http://code.google.com/p/pyprocessing/) file and save it as
`foo.py`:
from pyprocessing import *
def setup():
size(100,100)
def draw(... |
Set DJANGO_SETTINGS_MODULE as an Enviroment Variable in Windows permanently
Question: I have searched Web and Stack to this solution.
How can i permanently set the environmental variable `DJANGO_SETTINGS_MODULE`
on `WINDOWS` on a permanent basis and be done with it.
I mean
1. `Win Button` \+ `Pause/Break Button`
... |
How can I get all the plain text from a website with Scrapy?
Question: I would like to have all the text visible from a website, after the HTML is
rendered. I'm working in Python with Scrapy framework. With
`xpath('//body//text()')` I'm able to get it, but with the HTML tags, and I
only want the text. Any solution for ... |
Username and password using expect in python
Question: write a piece of code that ask the user to set a password \- queries the user
for his/her user name \- queries the user for his/her password twice, making
sure the user enters the same password twice \- Allow Only 3 attempts to get a
correct password
the rules for... |
convert string numpy array to a ascii numpy matrix
Question: I have been looking for an efficient way for converting a string numpy array
to a two dimensional ASCII matrix in python. So for this is the best that I
could come up with
def charArrayToAsciiMatrix(strNumpyArray):
for i in range(strNumpyA... |
Display a range of dates based on current date, in Python
Question:
import datetime
print datetime.datetime.now().strftime("Week of %m/%d")
#returns "Week of 04/18"
I want it to print "Week of 4/11 to 4/18" (with 4/13 being exactly one week
beforehand) and it would need to account for if th... |
Accessing Data from .mat (version 8.1) structure in Python
Question: I have a Matlab (.mat, version >7.3) file that contains a structure (data)
that itself contains many fields. Each field is a single column array. Each
field represents an individual sensor and the array is the time series data. I
am trying to open thi... |
How to get every single permutation of a string?
Question: I know how to get the permutations of just the plain string in python:
>>> from itertools import permutations
>>> perms = [''.join(p) for p in permutations('stack')]
>>> print perms
...
But how would I get the permutations of `'... |
How do i open a class from within another class by selecting an item on ToolBar?? Python/PyQt
Question: I am trying to run class AddTQuestions from a def in class AddTest but it wont
work!! It opens the window AddTQuestions for a split-second then closes it
straight away?!
The code is shown here:
import... |
Django with mod_wsgi how to set PYTHONHASHSEED env variable?
Question: How to run django with mod_wsgi with PYTHONHASHSEED environment variable set
to random? Is it a good approach to set it in django settings like this?
os.environ['PYTHONHASHSEED'] = 'random'
Answer: mod_wsgi 4.1.0 introduces an ... |
Python: re module to replace value in dictionary
Question: I started looking at the handy `re` module available in Python today, and
hoping I could get help with `re.sub`
My file:
avid "Av.Id
fated "fEIt.Id
leaded "lEd.Id
wicked "wIk.Id
I want to sub if match `"(v|t|d|k)\.Id"` then cha... |
Error when installing from requirements.txt of web project with pip
Question: This is the error message I received
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '... |
Disable wxMenuBar
Question: So I'm looking to disable and enable a wxMenuBar in wxPython. Basically, grey
out the whole thing.
If you look at the documentation:
<http://docs.wxwidgets.org/trunk/classwx_menu_bar.html> ... you can see that
the enable function takes a parameter for the menu item. As in, it doesn't
disabl... |
python CSV edit elements in the diagonal of a matrix
Question: I have a CSV file containing an n * n distance matrix, and here's a part of
view,

I want to use python to edit this CSV, making elements in the diagonal of the
matrix replaced by 1, how s... |
Random number function python that includes 1?
Question: I am new to Python and am trying to create a program for a project- firstly, I
need to generate a point between the numbers 0-1.0, including 0 and 1.0 ([0,
1.0]). I searched the python library for functions
(<https://docs.python.org/2/library/random.html>) and I ... |
Python "open" file got 'TypeError: function takes at least 2 arguments (1 given)'
Question: I've had a piece of code which basically read a txt file from directory.
def img2vector(filename):
returnVect=zeros((1,1024))
fr=open(filename)
for i in range(32):
lineStr=fr.readline()
... |
Writing and reading lists to text files in Python: Is there a more efficient way?
Question: Below is a program which asks the user to enter a recipe and stores their
ingredients in a set of lists. The program then stores the list data into a
text file. If option 2 is chosen it will retrieve the stored data from the
tex... |
How do I send an email with a .csv attachment using Python
Question: Okay, I know there is a few questions out there addressing this, but I cannot
find a way to make it work properly. I would assume it is as simple as the
below code, but this does not attach my file. Any help would be greatly
appreciated. I am also ver... |
Python: Processing each row independently using map function
Question: Assuming the list:
[[2,4,0,8],[0,2,4,8],[8,0,2,4],[8,2,0,4]]
Hi guys, how do I use map function to process each element inside the row of
the list?
For e.g. if I want to add the pairs of each list:
[[6,0,8,0],[2,... |
Failed to screen scrap ASP.Net website while posting data
Question: Getting Invalid postback or callback argument error while trying to screen
scrap a website which has build on ASP.NET.
Fist request of landing page has no issue. It's raising exception when I posts
form data after changing one of drop-down field value... |
python apscheduler, an easier way to run jobs?
Question: I have jobs scheduled thru `apscheduler`. I have 3 jobs so far, but soon will
have many more. i'm looking for a way to scale my code.
Currently, each job is its own `.py` file, and in the file, I have turned the
script into a function with `run()` as the functio... |
Are True, False, None keywords or built-ins in Python 3?
Question: So, in Python 2 it was clear. But in Python 3 I'm a little bit confused.
>>> import builtins
>>> dir(builtins)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferE... |
Turn a string with nested parenthesis into a nested list, python
Question: There are other questions referring to this on Stack Overflow such as [how-to-
parse-a-string-and-return-a-nested-
array?](http://stackoverflow.com/questions/17140850/how-to-parse-a-string-and-
return-a-nested-array?lq=1)
But they all refer to ... |
Make a Progress Counter in Concurrent Python
Question:
from multiprocessing import Process, Pool
from bs4 import BeautifulSoup
alreadyProcessedFile = 0.0
processLength = 0.0
def convertedFile(filePath):
fileName = os.path.basename(filePath).split('.')[0]
print("T... |
Print out array items greater than a specific Value in Python
Question: I am trying to print out values greater than 100000 on an array MSLP But I
keep on getting this error :The truth value of an array with more than one
element is ambiguous. Use a.any() or a.all()
Here is my code:
import numpy as np
... |
How can i move python functions into different .py file?
Question: i want to move functions because of lot of files, into separate python files.
But if i do it, it dont work.
I tried:
File: server.py:
import os, cherrypy, json
from customers.py import *
class application(object):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.