text stringlengths 226 34.5k |
|---|
Passing Parameters from Javascript to flask python script
Question: I am new to flask so bare with me.
Currently I have a angularjs file which uses $http.get to call my python flask
script.
In this flask script I want to then call another python script (which is
running pySolr), however the http.get call contains a p... |
MySQLdb and _mysql versions ncompatible: how to upgrade _mysql
Question: I'm running MySQLdb v1.2.3 and getting the following error:
LookupError: unknown encoding: utf8mb4
[This answer](http://stackoverflow.com/questions/21517358/django-mysql-
unknown-encoding-utf8mb4) suggests updating MySQLdb to ... |
How to use relative import without doing python -m?
Question: I have a folder like this
/test_mod
__init__.py
A.py
test1.py
/sub_mod
__init__.py
B.py
test2.py
And I want to use relatives imports in `test1` and `test2` like this
... |
Scrapy returning 403 error (Forbidden)
Question: I'm very new to Scrapy as well as to using Python. In the past, I have managed
to get a minimal example of Scrapy working but haven't used it since.
Meanwhile, a new version is out (I think the one I used last time was `0.24`)
and I can't, for the life of me, figure out ... |
Finding roots of function in Python
Question: I'm trying to calculate the roots for a function using the scipy function
`fsolve`, but an error keeps flagging:
TypeError: 'numpy.array' object is not callable
I assume it's probably easier to define the equation as a function but I've
tried that a few... |
How to preserve newlines in argparse version output while letting argparse auto-format/wrap the remaining help message?
Question: I wrote the following code.
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version', action='version',
ve... |
parse a string using regex
Question: I have a string
txt = 'text1 & ("text2" | "text3" | "text4") & "text5" ! (text6 | text7 | text8)'
Lets say I want to parse it so I end up with elements that are between
parenthesis. My pattern looks like
pattern = '\(([^\)(]+)\)'
using pytho... |
Reading csv and importing into datatable (Python)
Question: New to python,so im reading an excel csv and i want to import the results into
a datatable for use in later code, i.e i want to reference column names in
logic to generate results.
below is my code thus far, the excel reading bit is fine, i left that there to... |
Python plotly: remove empty spaces from bar chart
Question: I'm plotting a bar chart with the python library `plotly`, but there's
whitespace between the bars which I don't want.
import plotly
from plotly import graph_objs as go
xvals = [u'12.09', u'12.10', u'12.11', u'12.12', u'12.13', u'13... |
Python multiprocessing and shared numpy array
Question: I have a problem, which is similar to this:
import numpy as np
C = np.zeros((100,10))
for i in range(10):
C_sub = get_sub_matrix_C(i, other_args) # shape 10x10
C[i*10:(i+1)*10,:10] = C_sub
So, apparently there... |
Creating a diverging color palette with a "midrange" instead of a "midpoint"
Question: I am using python seaborn package to generate a diverging color palette
(seaborn.diverging_palette).
I can choose my two extremity colors, and define if the center is light->
white or dark->black (`center`parameter). But what I woul... |
Where to put logging setup code in a flask app?
Question: I'm writing my first Flask application. The application itself runs fine. I
just have a newbie question about logging in production mode.
The basic structure:
app/
app/templates/
app/static
config.py
flask/... <- virtual env with ... |
Numpy loadtxt: ValueError: Wrong number of columns
Question: Having the file TEST.txt structured as following:
a 45
b 45 55
c 66
When I try to open it:
import numpy as np
a= np.loadtxt(r'TEST.txt',delimiter='\t',dtype=str)
I have got the following error:
> V... |
apscheduler Lost connection to MySQL server during query
Question: I use apscheduler to execute regular job, and I got some error on it.
"Lost connection to MySQL server during query"
To find the answer, I try some test on it, and found out if my database(MySQL)
"wait_timeout" is less than schedule interval time then... |
Formatting Errors in Python
Question: I've never used Python and have copied some script (with permission) from
someone online, so I'm not sure why the code is dropping. I'm hoping someone
can understand it and put it right for me!
from os import walk
from os.path import join
#First some o... |
How to search for a child key in an xml and pass it to another parent with Python/bs4?
Question: Here is a sample of the xml I am working with:
<bare>
<key name="plus.root" value="/apps/mobile/plus"/>
<key name="local.root" value="/apps/net/plus"/>
<key name="slack.messaging.root"... |
Python Guessing game
Question: I am a beginner in python using 2.7.11 and i have made a guessing game. Here
is my code so far
def game():
import random
random_number = random.randint(1,100)
tries = 0
low = 0
high = 100
while tries < 8:
if(trie... |
python requests POST basic authentication returning 200 with empty body
Question:
import requests
s = requests.Session()
r = requests.Request('POST', 'https://'+url+'?name=value')
prep = r.prepare()
prep.headers = {'User-Agent': 'curl/7.38.0', 'Accept': '*/*', 'Authorization': 'Basic <load of hex>=... |
Python - AttributeError
Question: So for a line class I'm doing, I keep getting an error that says
AttributeError: Line instance has no attribute 'point0'
I'm declaring the line like this:
def __init__(self, point0, point1):
self.x = point0
self.y = point1
de... |
pySerial very strange behaviour ... Code works when executed in shell but not in a script
Question: I'm struggling with pySerial. To be brief ... The code below works great when
executed in the Python Shell ...
>>> import serial
>>> s=serial.Serial("COM5", 9600)
>>> while(1):
s.write("... |
Using TensorFlow with Sage
Question: I've written something in TensorFlow that makes use of some nice group theory
functions that work very easily in Sage (and seem prohibitively difficult to
code from scratch). The Sage part works on its own, and the TensorFlow part
works on its own, but I can't figure out how to get ... |
How to plot multiple regression 3D plot in python
Question: I am not a scientist, so please assume that I do not know the jargon of
experienced programmers, or the intricacies of scientific plotting techniques.
Python is the only language I know (beginner+, maybe intermediate).
**Task** : Plot the results of a multipl... |
Forever repeat of an eventloop after each loop completion, in python 3.4
Question: I am using python 3.4. I'm trying to have a loop of several tasks running
asynchronously and when one circle of loop was complete then again loop starts
from beginning. It is necessary to start the loop again only after the last
round wa... |
Sort and add elements of a list based on a common attribute
Question: I have a csv file that has the data:
California C1 A 1
. . . .
. . . .
. . . .
. . . .
so it looks like... |
Python: how to compute a fast measure of robustness on a network?
Question: I am working with a regular `NxN` network, and I need to determine a measure
of its robustness (namely, the ability to withstand failures). To do this, I
am using the [average node
connectivity](https://en.wikipedia.org/wiki/Connectivity_\(grap... |
not able to run threads simultaneosly in python
Question:
from threading import Thread
import time
def Function1():
print "11"
print "12"
time.sleep(5)
print "13"
print "14"
def Function2():
print "21"
print "22"
time.sleep(10)
... |
need help on configuring fortigate firewall CLI code for bulk ipmacbinding by importing a ip/mac entries list file
Question: i am facing a problem in ip/mac binding in fortigate 200d, the thing is i have
a list of 3000 entries of IP/MAC addresses, i have kept them in a csv file.
This is what i am looking for
1.I want... |
Django: How to return to previous URL
Question: Novice here who learned to develop a web app with python using Flask. Now I'm
trying to learn django 1.9 by redoing the same app with django. Right now I am
stuck at trying to get the current URL and pass it as an argument so that the
user can come back once the action on... |
Python: Multiprocessing - Suds - _pickle.PicklingError: Can't pickle <class> attribute lookup failed
Question: I'm making SOAP WSDL connection and then I want to run function in another
procces (threading is not suitable)
from suds.client import Client
class dTest:
def setup(self, clien... |
Regular expressions: replace comma in string, Python
Question: Somehow puzzled by the way regular expressions work in python, I am looking to
replace all commas inside strings that are preceded by a letter and followed
either by a letter or a whitespace. For example:
2015,1674,240/09,PEOPLE V. MICHAEL JO... |
Variable apparently not defined when it is
Question: Having an issue with a function I created in a separate file.
Here's my root program:
#Import TKINTER toolset:
from tkinter import *
from mousexy import *
#Starting variables:
#Defining mouse x and y coordinates
global mo... |
Python countdown clock with GUI
Question: I'm having problems with a countdown clock that I was making in Python for a
Raspberry Pi. I need to have a countdown clock that counts down from 60
minutes. When time runs out it should display a red text "GAME OVER".
I've already made one using TKinter and a `for` loop for t... |
Does there exist a surefire, cross platform way to reproduce a SIGBUS?
Question: This question is out of pure curiosity; personally I have seen this signal
being raised, but only rarely so.
I asked on [the C chatroom](http://chat.stackoverflow.com/rooms/54304/c)
whether there was a reliable way to reproduce it. And on... |
PyCharm module import error
Question: I am new to PyCharm and am having difficulty importing modules that I have
written into the Python console. If I try to import a module that is native to
Python I can import that module without difficulty but if I try to import a
module that I have written I get an ImportError: No ... |
Write Geopy location to CSV file
Question: I'm trying to write the output of this `geopy` object to a `csv` file, but it
puts each letter in a different column and prints the latitude and longitude
on a different line. How can I fix that?
I would like to be able to run this function at different times and print the
ne... |
scrapy general parse workflow
Question: I'm new to python and scrapy and wish to understand the methodology. I have
tried the official tutorial on scrapy and followed it but it is only a basic
example. My requirement described below is different and only a little more
complex.
There is a site which displays Items from... |
Python subprocess piping to stdin
Question: I'm trying to use python Popen to achieve what looks like this using the
command line.
echo "hello" | docker exec -i $3 sh -c 'cat >/text.txt'
The goal is to pipe the "hello" text into the `docker exec` command and have
it written to the docker container... |
TypeError: findall() takes at least 2 arguments (1 given)
Question: posted a much worse version of this question before. I've calmed down, refined
my searches and I've almost figured out what I need. I'm trying to extract all
the words ending in "ing" from a decently sized text file. Also, I'm supposed
to be using rege... |
Python Syntax Error (Unicode error)
Question: [Click here to see screenshot](http://i.stack.imgur.com/Bg04E.jpg)
I am trying to convert a CSV to XLS using Python 3.5.1 I have attached a
picture to show the issue
import csv, xlwt
files = ["C:\Users\Office\Documents"]
for i in files:
... |
Why do I get "table not found" even though I can see it created?
Question: I first created the User model before I read the Django documentation about
authentication so I put all attributes in the same model. So, later I tried to
split it into User and User profile. But when I run the the population script,
it says Use... |
Clicking Specific button with Selenium
Question: I am trying to click a particular button with Selenium in Python, but am
having trouble identifying that particular button. For example, if I was on
the google page of [this](https://www.google.com/webhp?sourceid=chrome-
instant&ion=1&espv=2&ie=UTF-8#q=ignominious), and ... |
how to call function from DLL in C#/Python
Question: I have next C++ code for create DLL file
// MathFuncsDll.h
#ifdef MATHFUNCSDLL_EXPORTS
#define MATHFUNCSDLL_API __declspec(dllexport)
#else
#define MATHFUNCSDLL_API __declspec(dllimport)
#endif
namespace MathFuncs
... |
How does one bypass SyntaxError when parsing code?
Question: I am using openpyxl to read an excel file that will have changing values over
time. The following function will take string inputs from the excel sheets to
make frames for Tkinter.
def make_new_frame(strng, frame_location, frame_name, frame_lis... |
Python tkinter Label
Question: Hi I have a little question about Label in tkinter.
When you use Label outside classes, you do something like
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text = "something", background = "something")
label.pack()
However, when it'... |
(Tkinter) Image won't show up in new window
Question: I just started using python tkinter and I have a button that opens a new
window. One the new window there is an image, but the image won't show up.Can
you please help me solve my problem?
from tkinter import *
def nwindow():
nwin = To... |
Wikipedia JSON parser in python
Question: i want to print extract of Wikipedia pages but for each search the page no is
changed so how to print extract with wildcard for page no.
i tried following code
import urllib2
import json
response = urllib2.urlopen('https://en.wikipedia.org/w/api.php... |
Python Iterate through list of list to make a new list in index sequence
Question: How would you iterate through a list of lists, such as:
[[1,2,3,4], [5,6], [7,8,9]]
and construct a new list by grabbing the first item of each list, then the
second, etc. So the above becomes this:
[1... |
Add multiplication signs (*) between coefficients
Question: I have a program in which a user inputs a function, such as `sin(x)+1`. I'm
using `ast` to try to determine if the string is 'safe' by whitelisting
components as shown in [this
answer](http://stackoverflow.com/a/11952618/4414003). Now I'd like to parse
the str... |
python - convert encoded json into utf-8
Question: I have several json files that need to be handled in a python script, although
it seems to NOT to be in a valid json format:
{
'data': [
{
'ad_id': u'6038487',
'adset_id': u'6038483800',
'campaign_id': u'6037... |
Flask: cannot import name 'app'
Question: Trying to run my python file `updater.py` to SSH to a server and run some
commands every few set intervals or so. I'm using APScheduler to run the
function `update_printer()` from `__init__.py`. Initially I got a `working
outside of application context error` but someone sugges... |
Python find second lowest value in list
Question: I have a list of lists, such that:
a = [[1,0.8,0.4,0.1,0.3,0.5,1],
[1,0.8,0.5,0.0,0.3,0.5,1]],
........................]
As can be seen in `a[1]` there is a negative value in the array. At some point
later on in my code, I subtract... |
local variable context_dict referenced before assignment
Question: I am making a django app .According to me everything is in views.py but when i
run the server it generates an error `local variable 'state' referenced before
assignment`
I have made the context_dict variable in the above view but then too it is
generat... |
Instagram API get location data on geotagged photo
Question: Is it possible to retrieve location data about a business or a venue a photo
was tagged at on `Instagram` using `python` and the `Instagram API`?
I have been using `access token` for my own account and have `Python
Instagram` installed.
Answer: You should ... |
Python: how to get the weekday from a CSV?
Question: I have a sample of CSV which contains various columns and i have to extract
the Weekday from the given `date` column. the sample is shown as below:
Name,Birthdate,Age,Address
ABC,3-10-2016 11:00:00AM,21,XYZ Street 21 zone
BCD,3-11-2016 15:54:00... |
adding data to database with columns continuously added
Question: Hello I am trying to add data to a database with sqlite3 in python. However, I
am not so sure on how to write the sql code to add data to a database that
continuously gets more columns. How would I write the sql code to add data to
database that continuo... |
UDF's in redshift : Possible to reference a udf within another
Question: Is possible to nest UDF's within each other ?
Following is a code for computing confidence intervals in A/B tests -
Ofcourse, I could write a huge function that does all-in-one, but wondering a
better way to achieve this goal ?
set... |
Connecting Python with Teradata using Teradata module
Question: I have installed python 2.7.0 and Teradata module on Windows 7. i am not able
to connect and quyey TD from python.
Pip install Teradata
Now i want to import teradata module using Python and perform operations like
-
1. firing querie... |
What happened to my code? --too many arguments Python error--
Question: So I have following code which eventually worked until some time ago:
import sys
from PyQt4 import QtCore, QtGui
from SerialMonitor import Ui_SerialMonitor
class StartQT4(QtGui.QMainWindow):
... |
Python client server dilemma
Question: I'm trying to implement a project, where the python code will be written on
web-browser and then executed in a remote server. The arch is Javascript -->
Java --> python
The python code will be sent to java using web sockets, which is connected to
a python server using a TCP/IP so... |
Python: AttributeError: 'str' object has no attribute 'datetime'
Question: I am using this code:
def calcDateDifferenceInMinutes(end_date,start_date):
fmt = '%Y-%m-%d %H:%M:%S'
start_date_dt = datetime.strptime(start_date, fmt)
end_date_dt = datetime.strptime(end_date, fmt)
... |
How to structure the Logging in this case (python)
Question: I was wondering what would be the best way for me to structure my logs in a
special situation.
I have a series of python services that use the same python files for
communicating (ex. com.py) with the HW. I have logging implemented in this
modules and i woul... |
Cross Validation for Logistic Regression
Question: I am wondering how to use cross validation in python to improve the accuracy
of my logistic regression model. The dataset being used is called 'iris'. I
have already successfully used cross validation for a SVM model but I am
struggling to adjust my code to do the same... |
How to import python file located in same subdirectory in a pycharm project
Question: I have an input error in pycharm when debugging and running.
My project structure is rooted properly, `etc./HW3/.` so that `HW3` is the
root directory.
I have a subfolder in HW3, `util`, and a file, `util/util.py`. I have another
fi... |
Error running basic tensorflow example
Question: I have just reinstalled latest tensorflow on ubuntu:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl
[sudo] password for ubuntu:
The directory '/home/ubuntu/.cache/pip/ht... |
Rotating an image using cImage
Question: I'm trying to rotate an image in Python by 90 degrees using cImage (and only
cImage) and here's what I've got so far.
def rotateImage90CW(imageFile):
myWin = ImageWin("90D", 350, 630)
oldIm = FileImage(imageFile)
newIm = EmptyImage(350, 630... |
How to find every walk in a numpy array
Question: I'm trying to find every single "walk" of length n through an array. A walk in
this case is defined as a sequence of length n of adjacent elements
(horizontal, diagonal, or vertical) in the array so that point is repeated.
For example, a 2x2 matrix
[1 2]
[4 8]
would... |
Attribute Error: at /auth/login/facebook/ Exception Value: operators
Question: Am Using the following configuration with django
**cassandra-driver (3.1.0)**
**Django (1.9.4)**
**django-cassandra-engine (0.7.0)**
**django-oauth-toolkit (0.10.0)**
**django-rest-framework-social-oauth2 (1.0.4)**
**djangorest... |
Python function to read JSON file and retrieve the correct value
Question: I'm reading a JSON file to retrieve some values with my extract_json function
and calling it by `time_minutes_coords = extract_json("boxes", "time_minutes",
"coord")` which gives me the right path to my coord value.
def extract_... |
Unable to import python library urllib
Question:
sudo apt-get install python-urllib
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-urllib
Why is it coming like this?? Please help out
Answer: Consult [this pa... |
Python: infos about the implementation of a Python function
Question: I'm discovering the CPython implementation, the structure of Python objects
and the Python bytecodes.
Playing with functions, I've found out that empty functions have a stack size
of 1.
Why? **What var is declared to occupy the stack space?**
... |
TypeError: 'list' object is not callable: why?
Question:
from difflib import get_close_matches
order_output = {
"initiate ion drive" : "Initiating the ion drive.",
"run" : "Running",
"eat" : "Eating",
"enter coords to" : "Settings coords to:"
}
orders_list... |
Is array preferred over set or map?
Question: I recently interviewed with a company in the bay area (CA,USA). One of the
questions was to simply find if a string has repeated characters(I have
simplified a lengthy question).
>
> eg:
> input : "qwerrty"
> output : True
>
I used python to code this.
I ga... |
multi thread issue in Python
Question: New to Python multi-thread and write such simple program, here is my code and
error message, any ideas what is wrong? Thanks.
Using Python 2.7.
import time
import thread
def uploader(threadName):
while True:
time.sleep(5)
... |
is it possible to use the discovery module from the Google apiclient in Cloud Datalab?
Question: I have a simple python script that does something like this:
from apiclient import discovery
from oauth2client.client import GoogleCredentials
ggSvc = discovery.build ( 'genomics', 'v1', credentials=c... |
Invalid default value for user_id_id in django
Question: I am new to django and I am creating my models but I am having trouble when
trying to add a foreign key to another model. here's my models:
from django.db import models
class User(models.Model):
user_id = models.CharField(max_lengt... |
How to install GDAL/scipy using cmd in window?
Question: I downloaded `scipy-0.17.0-cp27-none-win_amd64.whl` and
`GDAL-1.11.4-cp27-none-win_amd64.whl` from
[gohlke](http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy) in
**C:\Python27\Scripts**
To install I used
`pip install scipy-0.17.0-cp27-none-win_amd64.whl pip inst... |
Sorting list of values in the returned dictionary in ascending order-Python
Question: Following functions return a reverse of the input dictionary where the values
of the original dictionary are used as keys for the returned dictionary and
the keys of the original dictionary are used as value for the returned
dictionar... |
Bi-grams in python with lots of txt files
Question: I have a corpus which includes 70,429 files(296.5 mb). I try to find bi-grams
by using whole corpus. I have written the following code;
allFiles = ""
for dirName in os.listdir(rootDirectory):
for subDir in os.listdir(dirName):
... |
Python converting lists into 2D numpy array
Question: I have some lists that I want to convert into a 2D numpy array.
list1 = [ 2, 7 , 8 , 5]
list2 = [18 ,29, 44,33]
list3 = [2.3, 4.6, 8.9, 7.7]
The numpy array I want is:
[[ 2. 18. 2.3]
[ 7. 29. 4.6]
[ ... |
Can't get value from multidimensional array
Question: I've been doing a lot more Python than PHP recently so perhaps I've forgotten
something important, but as far as I can see, this looks like it should work.
What's actually wrong with it?
$form_settings = array('typeofzone' >= array('tm', 'tp', 'tc'),
... |
Kivy Images Not Showing Without Added Time
Question: # Summary of this app:
* Raspberry Pi running Raspbian Jessie and output to TV
* Python 3.4
* Kivy 1.9.1
* pet information is pulled through a SOAP request
* the information is parsed
* a kivy window is created and the pet information is displayed for a ... |
Sum up values in dictionary in Python 2.7
Question: I have a dictionary with data for every 0,04 sec, looking like that
{1: 0, 2: 4.22109297745, 3: 0.324239117507, 4: 3.99972239616 ...}
keys represent time and values — data I received. I need to count the
arithmetic mean for every second. So first ... |
Retrieve specific rows of CSV file containing a particular keyword in Python
Question: I am currently trying to extract particular rows that contain certain
keyword(s)(e.g. 'battery' etc.) from a large csv file.
I have the following code written but it seems not to work for the filter
part.
keywords... |
python why data type changed by def function?
Question: Why num_r1(x) and num_r2(x) type numpy.ndarray, but num_r(t) is type float?
How can I keep num_r(t) type as array?
def num_r(t):
for x in t:
if x>tx:
return num_r2(x)
else:
return num_r... |
Import of excel in odoo on Ubuntu 14.04 - not working
Question: When I tried to import an excel file in odoo from Windows it worked perfectly.
But when tried this from Ubuntu machine it didn't work. It showed me this
error
**"import preview failed due to: Unable to load "xlsx" file requires Python
module "xlrd >= 0.8"... |
Return 'similar score' based on two dictionaries' similarity in Python?
Question: I know it's possible to return how similar two strings are by using the
following function:
from difflib import SequenceMatcher
def similar(a, b):
output=SequenceMatcher(None, a, b).ratio()
return output... |
Integrating Python into Java - can we call .py files directly?
Question: I am trying to understand Jython. I have some algorithms written in Python
that I want to integrate in Java. The Jython docs are very complex for me to
understand. All I could get from them is that I can run individual Python
statements from Java ... |
Splitting the dictionary into multiple copies in python
Question: I have a python dictionary
d = {
'facets':{'style':"collared",'pocket':"yes"},
'vars':[ {'facets':{'color':"blue", 'size':"XL"}},
{'facets':{'color':"blue", 'size':"L"}} ]
}
Since ther... |
PyUsb does not recognize my USB device while my PC does
Question: I'm trying to communicate between the my PC and PIC18F4550, but the program is
not detecting it whereas the computer is showing it in [Device
Manager](http://en.wikipedia.org/wiki/Device_Manager).
import usb.core
dev = usb.core.fi... |
Is is bad design for a parent class's method in Python to produce instances of its children?
Question: I am doing some work with the Wikipedia category graph (using Python 3.5), and
have run into a design problem.
I have a base class Page, which defines some methods common to both articles
and categories, as well as c... |
Python: Initialising a new derived class in a method of a base class
Question: My situation is that I have access to two classes that work nicely together.
Modifying their code extensively is probably not possible but maybe small
changes could be implemented. However, there are some small extensions to both
classes tha... |
Troubles of making Django Models work on MS-SQL on MS Azure?
Question: I want to create a django web on Azure.
I spent all day on trying to connect my model classes to an exist MSSQL
database on Azure.
It still did not work. My hand is tried.
I list my steps, and hope someone to help me thanks a lot!
Step1. Install... |
Capture any occurrence of word in a text; RegEx; Python
Question: I have a list of words that I want to cross-reference with a bunch of texts,
and if a word from the search string is present in the text, I want to retain
the text.
search_string = ['Good', 'Bad', 'Ugly']
My code so far is:
... |
Redmine: remove archived projects
Question: I would like to remove all archived projects on my redmine installation. Doing
so from my browser works, but I have 400 of them...
I had the idea to script it, but the [redmine REST
api](http://www.redmine.org/projects/redmine/wiki/Rest_api_with_python)
doesn't seem to expos... |
How to delete columns in xlwings?
Question: I'm using `xlwings` on Windows (Excel 2007 with Python 2.7) and would like to
delete either ranges or columns with `xlwings`. As far as I could see,
deletion of a range or a column is a missing feature, so I tried to follow the
instructions given
[here](http://docs.xlwings.or... |
Encoding error when combining text files
Question: I'm trying to run this code:
import glob
import io
read_files = filter(lambda f: f!='final.txt' and f!='result.txt', glob.glob('*.txt'))
with io.open("REGEXES.rx.txt", "w", encoding='UTF-32') as outfile:
for f in read_f... |
Python CSV - Combine, clean and to output emails in correct format
Question: I am trying to take more than 1 file with information such as names, email
addresses, and other. To take these files from CSV format and remove
everything except the emails. Then output a new file with delimiter of
semicolon all on same line. ... |
Splitting my code into multiple files in Python 3
Question: I wish to split my code into multiple files in Python 3.
I have the following files:
/hello
__init__.py
first.py
second.py
Where the contents of the above files are:
**`first.py`**
from hello.second... |
Unable to solve "ImportError: No module named '_tkinter'"
Question: When I try to run my program I keep getting the `ImportError: No module named
'_tkinter'` error. I tried two things which I found could solve this problem:
sudo apt-get install python3-tk
sudo apt-get install tk-dev
They b... |
How do I specify which python and which modules are being used in my jupyter notebook?
Question: When I do
import sys
sys.executable
I get `'/usr/local/opt/python/bin/python2.7'` in my ordinary python shell and
`'/usr/bin/python'` in IPython or my jupyter notebook. I would like to force
my jupy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.