text stringlengths 226 34.5k |
|---|
Parsing a string with spaces from command line in Python
Question: Is there a way to call my program in python and pass it a string I want it to
parse without declaring the string as `'String I want to parse'` but as
`String I want to parse`
import argparse
#Parse command line for input
pars... |
matplotlib: Don't compress plot in the horizontal direction
Question: I am very new to matplotlib and I am having some difficulty with this figure:
[](http://i.stack.imgur.com/CDuGd.png)
I have a text file with x y point groups that I should plot. How... |
How to make columns and rows dynamically in PyQt?
Question: I am making a GUI desktop application using python3, PyQt5 in windows 7.
What I'm trying to do is:
1. when my application runs, it makes an empty table using QTableWidget. There're also four buttons.
2. When a user clicks the first button, the empty ta... |
Grouping all tests Python
Question:
I have 2 modules: test1.py and test2.py.
**test1.py**
import unittest
class ArithTest (unittest.TestCase):
def test_run (self):
""" Test addition and succeed. """
self.failUnless (1+1==2, 'one plus one fails!')
... |
Adding numbers from a file - Python
Question: I am trying to add numbers by reading a file.
The file has texts and numbers, so I need only numbers and add them to display
the total.
It is always showing the value as zero. Don't know where I do wrong.
Here's the code:
import re
file1 = open('Actual... |
Most efficient way to find neighbors in list
Question: I have a list of length 2016, but only 242 contain data, the rest is set to
None. My aim is to interpolate between the values to fill all gaps with a
simple form of IDW (inverse distance weighting). So the task of my script is:
* Iterate over all items of myList... |
How to convert HEXEWKB to Latitude, Longitude (in python)?
Question: I downloaded some Point of Interest data from OpenStreetMap and as it turn
outs the locations are encoded in HEXEWKB format:
CSV fields
==============================================
1 : Node type; N|W|R (in upper case), wheter... |
django 1.8 does not work on CentOs 6.5 server
Question:
Installing collected packages: Django
Successfully installed Django-1.8
[root@manage ~]# PYTHON
-bash: PYTHON: command not found
[root@manage ~]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.... |
Function to write lines in CSV file? Or parse list?
Question: I have a python script with no functions. At the moment, it takes in an input
`file1.txt` and outputs a string with results from the calculation, i.e.
file1.txt 12 16.0 True
I would like to run through dozens of text files and write thes... |
Theano and Celery : Worker exited prematurely: signal 11 (SIGSEGV)
Question: I'm building a web app where I start the training of a neural network
implemented with theano on the server side by sending an ajax request from the
client. Obviously I don't want to wait for the server to train the network
entirely to send an... |
Find the same pattern in two files python
Question: Im trying to find a word that is in a file and search for that word in two
different files \- to search that word in the first file and if the word is
found the the line is printed in a new file \- to search for the same word in
a second file and if the word is found ... |
AttributeError: 'module' object has no attribute 'MutableMapping'
Question: I followed the instructions for installing Google Tensorflow and its
dependencies on an Ubuntu 14.04 g2.8xlarge aws instance. While trying to run
the example problems, I'm running into the error posted below. Any help would
be greatly appreciat... |
draw matrix as a table in python
Question: I am trying to generate a data matrix with python and wish to draw it as a
table. From IPython, I found a display api and it can display the matrix as a
table. but I still prefer: 1\. remove the row index col and col index row. 2\.
the data grid should split evenly.
I am thin... |
Python : Runtime Warning : Overflow encountered in square, add, multiply, substract
Question: I'm beginning with Python so I might be asking a not so subtle question, but
after quite a lot of research I couldn't resolve this error. I'm actually
trying to solve a physics problem using the Gray-Scott model, but I'm stuck... |
Efficiently filter windowed observations in a pandas dataframe if they contain a certain value
Question: I have a pandas dataframe that has windows/chains of string observations
indexed at the offset of their first observation. The window is of a variable
but known length. For this example we can say their chains of 4 ... |
Passing arguments to shell script from Python
Question: I'm writing a python program which passes arguments to a shell script.
Here's my python code:
import subprocess
Process=subprocess.Popen('./copyImage.sh %s' %s str(myPic.jpg))
And my "copyImage.sh":
#!/bin/sh
... |
Making Fill Plot Matplotlib - Error: invalid type promotion
Question: I am trying to create a fill plot using Matplotlib in Python (I am using
spyder IDE) using the code below. However, I receive the error posted at the
bottom of the code. The dataframe I want to plot contains dates along the
x-axis and then a range of... |
Insert Google Analytics API data to postgresql [python]
Question: I want to store bulk data to postgresql. The data I got are from google
analytics [API]. The data is about pageviews and here is my code:
data = '[["20151201","path","title",345], ["20151202","path","title",321], ["20151203","path","title"... |
Django error: No module named _mysql
Question: I am migrating my app on prod mariadb database from default django's sqlitedb.
There are python3.3 + centos 7 + django 1.8 + apache envirounment. On sqlite
everything is working fine but after there migration i have such error after
apache restarting:
Traceb... |
hasMany not updating ember store
Question: I am using ember django adapter as my backend is designed in
python/django.(<http://dustinfarris.com/ember-django-adapter/>)
feed.js (model)
import DS from 'ember-data';
const {attr} = DS
export default DS.Model.extend({
gallery_name:... |
Which logger should I use to get my data in Cloud Logging
Question: I am running a PySpark job using Cloud Dataproc, and want to log info using
the `logging` module of Python. The goal is to then push these logs to Cloud
Logging.
From [this question](http://stackoverflow.com/questions/34186511/output-from-
dataproc-sp... |
Google API Build Service Object returns KeyError: 'rootUrl'
Question: I have a flask application where I can run a script (with the help of Flask-
script) that makes use of google api discovery using the code below:
app_script.py
import argparse
import csv
import httplib2
from apiclient... |
Write Excel file from Outlook Emails
Question: I have written some code in Python that reads through emails in an Outlook
folder using win32com.client. I can read it in easily, have all of the logic
built out, now want to write an Excel file as I iterate through all of the
messages. This is where I have a problem.
My ... |
Issues with Folium Choropleth Mapping Example
Question: I am trying to create a choropleth map using folium, following the example
here: <https://pypi.python.org/pypi/folium>. The goal is to produce a
choropleth map of US unemployment rates, but when I open my map US states are
not shaded in. Any suggestions?
... |
How do you run a python file from cmd or Python Shell or setup a workspace?
Question: I have looked at [this
explanation](http://stackoverflow.com/questions/1522564/how-do-i-run-a-python-
program) on how to put Python as a system variable for `Path`. This worked
successfully and from my `cmd` I can now run python which... |
How do you get the time and date in python?
Question: I am trying to get the date and time on python for a program I am writing, But
am unsure how to get them. I tried doing:
import dateline
import date
This usually works but now it just prints:
<module 'time' (built-in)> <module... |
TypeError: can only concatenate list (not "int") to list 4
Question: I'm required to take a Python module for my course and I get this error for my
script. It's plotting the trajectory of a projectile and calculating a few
other variables. I've typed the script exactly as in the booklet we are given.
Because I am an ab... |
elastic beanstalk, awsebcli, and blessed 1.9.5
Question: I was using the elastic beanstalk cli with AWS without any difficulty a few
months ago. I wanted to update my website and ran into this error:
> me$ eb status Traceback (most recent call last): File
> "/Library/Frameworks/Python.framework/Versions/2.7/bin/eb", l... |
Trying to timeit my sqrt function in Python
Question: So I've tried to code a simple square root function. I did, and I wanted to
compare it with Python's original one. Here's my code:
from math import sqrt
import timeit
def sqrt2(number):
i=1
while i**2<number:
i... |
pyodbc error on OS X machine?
Question: I'm trying to do access the remote MS-SQL database from my OS X machine, with
help of pyodbc and python. When I try to execute, it's showing an error like
this
Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver spe... |
How to save a 3D array in python and Import it in mathematica
Question: I want to save a 3D binary array in .txt file or .csv file on python and
import it onto mathematica.
I googled and I found a lot of answers, I try this:
import numpy as np
a=np.zeros((2,3,4))
a[0,0,0]=10
cPickle.dump( a,... |
HTML templates using Jinja2
Question: I need help with my main.py file, I can't manage to make my webapp to post
comments and save them with the user name.
This is my main code. main.py
import os
import jinja2
import webapp2
from google.appengine.ext import ndb
template_dir = o... |
HTML Scraping with Python, document_fromstring is empty
Question: I am trying to extract some data from a website using python. I found a
([document](http://docs.python-guide.org/en/latest/scenarios/scrape/) that
exactly fits to my problem.
But when I run the provided code
from lxml import html
impo... |
2to3 conversion for strings
Question: I have written a small Qt-based text editor for Python code that I embed in my
application. Now I am going to switch to Python 3 and I want to help the users
of my app with converting their code. I know that `2to3` can do most of the
conversion for files. However, I need an on-the-... |
How Do I Send Emails Using Python 3.4 With GMail?
Question: I've been trying bits of code such as:
import smtplib
def sendemail(from_addr, to_addr_list, cc_addr_list,
subject, message,
login, password,
smtpserver='smtp.gmail.com:587'):
... |
Linking a FuncAnimation() with a Button in Python 2.7
Question: I am trying to start a graph (which is it's getting data from serial port) on
a button's click. I had tried the following code but was not successful. I am
new to python. Please help me in guiding were I am wrong.
I am using Python 2.7 with Tkinter
Thank... |
How to get preview from childs in notebook like in sublime or terminology
Question: For example I have a window with a notebook widget and in this notebook I have
two tabs which contain one vte widgets each The idea it to get a preview of
each vte widgets (You know like in Terminology) here is the simple code I have
so... |
Tkinter Python GUI Issues
Question: Below is my code, it runs but I'm not sure how to get the "Run text" button to
prompt me to open text file in new window, currently a new window appears with
a "Quit" button, nothing else.
import tkFileDialog
import Tkinter as tk
from Tkinter import *
impor... |
Python: how to get this elegantly?
Question: I'm new to Python and I wrote a function:
def f(x, y, z):
ret = []
for i in range(x):
for j in range(y):
for k in range(z):
ret.append((i, j, k))
return ret
print f(2, 3, 4)
... |
In python, when use multiprocessing Pool, main process can not finished in some situation
Question: first situation, main process can not finished,
from multiprocessing import Pool, Queue
queue = Queue()
def handle(slogan):
for i in xrange(100000):
queue.put(slo... |
In Python's Seaborn, is there any way to do the opposite of `despine`?
Question: `seaborn` is a beautiful Python package that acts, for the most part, as an
additional layer on top of `matplotlib`. However, it changes, for instance,
things that would be `matplotlib` methods on a plot object to direct `seaborn`
function... |
Why does the OrderedDict keys view compare order-insensitive?
Question: Why does the `OrderedDict` keys view compare order-insensitive?
>>> from collections import OrderedDict
>>> xy = OrderedDict([('x', None), ('y', None)])
>>> yx = OrderedDict([('y', None), ('x', None)])
>>> xy == yx
Fa... |
Ipython kernel dies unexpectedly reading large file
Question: I'm reading in a ~3Gb csv using pandas in an ipython notebook. While reading
the file, the notebook unexpectedly gives me an error message saying the
kernel appears to have died and will restart.
As per several "big data" workflows in python/pandas, I'm rea... |
Merging two GEOJSON polygons in Python
Question: Is there a way to merge two overlapping GEOJSON polygons in python, returning
a single merged GEOJSON object?
Answer: This is how I was able to do it using the packages/modules json, geojson,
shapely, pyproj, and partial from functools:
import json
i... |
MultiPartParserError :- Invalid boundary
Question: Im trying to send some data and file using Python requests module to my django
rest application but get the below error.
raise MultiPartParserError('Invalid boundary in multipart: %s' % boundary)
MultiPartParserError: Invalid boundary in multipar... |
Scrapy cannot find spider
Question: I am doing scrapy tutorial in [scrapy
documentation](http://doc.scrapy.org/en/1.0/intro/tutorial.html) . This is my
current directory looks like:
.
βββ scrapy.cfg
βββ tutorial
βββ __init__.py
βββ __init__.pyc
βββ items.py
βββ pip... |
Error with HTTP Post in python requests library
Question: I am not able to send a http post request via python(Flask).
Here is my python code.
import json
from flask import Flask, render_template, request, jsonify
import requests
app = Flask(__name__)
@app.route("/",methods=['G... |
How to check a Python script's the correct version automatically while the shebang is not accurate?
Question: For example, I find
[download_model_binary.py](https://github.com/BVLC/caffe/blob/master/scripts/download_model_binary.py)'s
shebang is wrong while it contains a Python 2 library function
`urllib.urlretrieve`.
... |
Python:Getting text from html using Beatifulsoup
Question: I am trying to extract the ranking text number from this link [link example:
kaggle user ranking no1](https://www.kaggle.com/titericz). More clear in an
image:
[](http://i.stack.imgur.com/sClUu... |
can't terminate a sudo process created with python, in Ubuntu 15.10
Question: I just updated to Ubuntu 15.10 and suddenly in Python 2.7 I am not able to
**terminate** a process I created when being **root**. For example, this
doesn't terminate tcpdump:
import subprocess, shlex, time
tcpdump_command =... |
python 2.7 : create dictionary from list of sets
Question: After performing some operations I get a `list` of `set` as following :
from pyspark.mllib.fpm import FPGrowth
FreqItemset(items=[u'A_String_0'], freq=303)
FreqItemset(items=[u'A_String_0', u'Another_String_1'], freq=302)
FreqIte... |
TensorFlow no attribute 'make_template'
Question: I am trying to get familiar with tensorflow and NNs. I recently crashed into
this problem when I tried to use `tensorflow.make_template()`. I first noticed
that there were no auto-complete option in the IDE I use, and then I just
tried to call the function from the pyth... |
How to not await in a loop with asyncio?
Question: Here is a toy example that downloads the home page from several websites using
asyncio and aiohttp:
import asyncio
import aiohttp
sites = [
"http://google.com",
"http://reddit.com",
"http://wikipedia.com",
"ht... |
Incomplete parsing of entire genbank file using python/biopython
Question: The main goal of my script is to convert a genbank file to a gtf file. My
problem pertains to extracting CDS information (gene, position (e.g., CDS
2598105..2598404), codon_start, protein_id, db_xref) from **_all_** CDS
entries. My script should... |
Import functions directly from Python 3 modules
Question: I have the following folder structure for a Python 3 project where
`vehicle.py` is the main script and the folder `stats` is treated as a package
containing several modules:
[](http://i.stack.im... |
Analysing Time Series in Python - pandas formatting error - statsmodels
Question: I am trying to analyse stars' data. I have light time series of the stars and
I want to predict to which class (among 4 different types) they belong. I have
light time series of those stars, and I want to analyse those time series by
doin... |
How to incorporate code into a for loop using Python
Question: Edit: Here is the code I am trying to use:
from bs4 import BeautifulSoup
import re
import sys
m = re.compile("^\d\d:\d\d$")
readfile = open("C:\\Temp\\LearnPythonTheCompletePythonProgrammingCourse_Udemy.htm", 'r').read()
s... |
Pandas Bar Graph: Side By Side (No X or Y axises shared)
Question: [Two Bar Plots- Non side by side](http://i.stack.imgur.com/XFt3A.png)
Hi, I am relatively new to Pandas and Python. I have been trying to get my two
bar graphs to be displayed side by side instead of showing it one after
another as it is in the image a... |
Generator Reading Log File While Name Changes Python
Question: The goal is to read a log file in real time line by line (standard generator
stuff) but the catch is, the file name changes at various intervals. The name
change can't be helped (application dictated appended with a time string) and
the name is changed when... |
Matplotlib error with colormap in version 1.5.0
Question: In a python script, I just upgraded my matplotlib to 1.5.0 and am now getting
this error:
from matplotlib import pyplot as plt
import matplotlib.ticker as tkr
from matplotlib import rcParams
from mpl_toolkits.basemap import Basemap, ma... |
How to tab seperated txt file to csv in python
Question: I have a txt file of 7 columns and about 8000 rows. the name of the file is
"Azimuth"
The first row- Id Xs Xe Ys Ye Length Azimuth
and each row under is a unique measurement. so this is a txt file with 8000
measurements. the data is tab separated or so it seems... |
Tensorflow: No shape function registered for standard op: ExtractGlimpse. Where do I add my code for the shape function?
Question: I am trying to build a tensorflow graph using `tf.image.extract_glimpse`.
Unfortunately I think there is a bug in the API itself. I am receiving the
error `No shape function registered for... |
PDF Miner PDFEncryptionError
Question: I'm trying to extract text from pdf-files and later try to identify the
references. I'm using pdfminer 20140328. With unencrypted files its running
well, but I got now a file where i get:
> File "C:\Tools\Python27\lib\site-packages\pdfminer\pdfdocument.py", line
> 348, in _initia... |
Python - Input contains NaN, infinity or a value too large for dtype('float64')
Question: I am new on Python. I am trying to use sklearn.cluster. Here is my code:
from sklearn.cluster import MiniBatchKMeans
kmeans=MiniBatchKMeans(n_clusters=2)
kmeans.fit(df)
But I get the following err... |
python something like assertFunctionNotCalled?
Question: Edit: This question refers to python 3.5
In python unit testing, is there a way to assert that a given block of code is
not called?
I have a function I am testing that can follow either of two branches: a
faster, more reliable branch if the user has logged in b... |
How to consume JSON response in Python?
Question: I am creating a Django web app. There is a function which creates a JSON
response like this:
def rest_get(request, token):
details = Links.get_url(Links, token)
result={}
if len(details)>0:
result['status'] = 200
... |
Rotate point about another point in degrees python
Question: If you had a point (in 2d), how could you rotate that point by degrees around
the other point (the origin) in python?
You might, for example, tilt the first point around the origin by 10 degrees.
Basically you have one point PointA and origin that it rotate... |
Feasibility of automatic cycle breaker for `std::shared_ptr`
Question: C++11 introduced reference-counted smart pointers, `std::shared_ptr`. Being
reference counted, these pointers are unable to automatically reclaim cyclic
data structures. However, automatic collection of reference cycles was shown
to be possible, for... |
How do I play a .wav file using Tkinter on Mac?
Question: I am trying to get a laughing track to play whenever you die in my text
adventure game, I am using Python but since I have no clue how to use Tkinter
on Python. I never used TKinter so I need some help. If you are wondering
where the file is, It is in a folder I... |
Python Subset dataframe with another dataframe
Question: I'm transitioning from R to Python and trying to subset a dataframe with a
field in another dataframe. What would be the Python Equivalent for this R
code:
final_solution <- subset(df1, item %in% df2$item)
Thanks
Answer: We can try
... |
Sending a constant rate data stream from Droid via TCP/IP
Question: in my quest to learn Java / Android development, Iβm running into lots of
roadblocks. Mainly because I donβt really know much about threading and
communication between threads/processes. Iβm trying to stream the IMU data
from an android device to a pyt... |
Using Try/Except statement in Python
Question: my code is as follows:
import mechanize
import urlparse
import util
url = "https://math.berkeley.edu/~strain/"
urls = [url]
visited = []
link_pdf = []
br = mechanize.Browser()
br.open(url)
while len(urls) > 0:
... |
Scapy OSError when importing scapy.all: 'wpcap.dll' does not exsist
Question: I tried to import `scapy.all`, but an error saying 'wpcap.dll' does not exist.
Why does this happen? I am sure I downloaded everything correctly. I saved
everything into a folder called `scapy` . I got an OSError from module
`ctypes`. Does Py... |
Why can't I compare these form variables using python in my mysql query?
Question: I am trying to check for a string that is being passed from a form in an html
page. So the form picks up the user name and then checks the database if it
already has been made. If it hasn't, it goes ahead and creates it. My errors
are in... |
How to parse text in multiple body tags with BeautifulSoup in Python?
Question: I want to parse this website: <https://www.flyingv.cc/project/3724>
and I want fetch the information in the html source code.
Just like this information, 2830:
<span class="sharenumber" id="fb_share_span">2830</span>
... |
Reload module from a folder?
Question: Since IPython Notebook does not reload the file after I modified my module, I
am trying to reload it. There was a
[post](http://stackoverflow.com/questions/5516783/how-to-reload-python-module-
imported-using-from-module-import) on how to do similar things, but my problem
is when t... |
How to I create a ticking time series with Reactive Extensions for Python (RxPY)?
Question: ## My Setup:
I have a list of stock price data in (time, price) tuples:
from datetime import datetime
prices = [(datetime(2015, 1, 9), 101.9), (datetime(2015, 1, 12), 101.5), (datetime(2015, 1, 13), 101.7)]
... |
How to write a Dockerfile for a custom python project?
Question: I'm pretty new to Docker, and I need to create the container to run Docker
container as an Apache Mesos task.
The problem is that I can't find any relevant examples. They all are centered
around Web development, which is not my case.
I have a pure Pytho... |
run test cases in parallel python
Question: I would like to get some help for running multiple python test cases in
parallel using multiprocessing module. I have created a class FooTest with 10
test cases in it (testA, testB...). There is a test case test_foo outside the
class.
How can I run all the test cases in para... |
Saving a matplotlib animation in Linux
Question: I'm having a problem saving a matplotlib animation. When I execute the
following test script:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
... |
Python - How to get variable from netcdf file on a specefic location and at different level
Question: I am learning on how to plot various variable from WRF output netcdf file. My
requirement is to extract variables for a certain lat long (8.4875Β° N,
76.9525Β° E) so that to plot SkewT using matplotlib package.
Similar ... |
How do i remove all character besides digits and "," from unicode string in python?
Question: I'm writing small crawler using scrapy. One of XPath's is containing price
followed by "zΕ" (polish currency mark) the problem is it's obfuscated by new
line characters, spaces and non breaking spaces. so when I do :
... |
How to add/use libraries in Python (3.5.1)
Question: I've recently been playing around with python and have now expanded into doing
stuff like scraping through websites and other cool stuff and I need to import
new libraries for these things like lxml, pandas, urllib2 and such. So I have
Python 3.5.1 installed and is a... |
TypeError: 'NoneType' object is not callable (Python: Scraping from HTML data)
Question: I am trying to scrape the numbers from HTML data so that I can get the sum of
them. However, I am running into the above error when I try to run it. It is
referring to the "data = " line. What is this error referring to in this lin... |
repeating program (python)
Question: Heyho
I want to repeat a program after runnning a task. At the start of the program
I ask some questions, than the code jumps into the task. If the task is done
the questions sholud ask again.. Each Question reads some infos at the serial
port. If i get the infos ten times ich will... |
How to structure python project for use with coverage.py?
Question: I have a package with the following layout:
tiny-py-interpreter/
|-- setup.py
|-- .coveragerc
|-- tinypy/
| -- foo/
| -- bar/
| -- tests/
| -- tinypyapp.py
| -- run_tests.py
Here ... |
Learn Python the Hard Way - How to use +=
Question: Currently on exercise 20, study drill 5. The code is thus:
from sys import argv
script, input_file = argv
def print_all(f):
print f.read()
def rewind(f):
f.seek(0)
def print_a_line(line_count, f): ... |
Using Python Functions in Terminal
Question: I'm just starting to learn Python and I'm having a hard time testing things
out in the terminal. What I want to do is simply run a pre-written Python
method in the Python interpreter. (I know how to run it by doing python
file_name.py, but I want to run it in the interpreter... |
Python: Printing dataframe to csv
Question: I am currently using this code:
import pandas as pd
AllDays = ['a','b','c','d']
TempDay = pd.DataFrame( np.random.randn(4,2) )
TempDay['Dates'] = AllDays
TempDay.to_csv('H:\MyFile.csv', index = False, header = False)
But when it prints it... |
setting sys.path to have the parent module path doesn't import the sub module
Question: The project is in Python3:
Project
|
Mymodule
__init__.py
|
submodule1
__init__.py
some_script.py
|
submodule2
__init__.py
myclass.py -> implemen... |
python script runs on its own through terminal but not when it's executed in Java with Runtime.getRuntime().exec()
Question: python script runs on its own through terminal but not when it's executed in
Java with Runtime.getRuntime().exec()
here's my script. i set my python interpreter in Eclipse the proper way and I
d... |
Cannot import name random/multiarray in conda environment
Question: I'm trying to run tensorflow in a conda environment. I started off by creating
a python 2.7 environment with `conda create --name py27 python=2.7` and then
activated it. Within the environment, I ran `conda install -c
https://conda.anaconda.org/jjhelmu... |
Python regular expression, remove repeated class
Question: I have a bunch of timestamp strings. Each string has three sections and
delimiters between sections. A delimiter may be any of these [.:,;] symbols.
Each section contains digits. The first one may contain one or two digits. Any
other section may contain two dig... |
I do not understand how this Python code works - Unknown programming concept
Question: My apologies for the crappy headline. If I were able to frame my problem
properly I would have used google ;)
I found an piece of python code able to parse ini files into a python dict
called "store":
#!/usr/bin/env p... |
Finding a variable in the .txt and comparing the values within two variables?
Question:
----bDdefsYG3wqContent-Disposition: form-data;name="QueryResult"Content-Type: application/JSON;charset=utf-8-Context: efb3d3ce-ef50-4e83-8c31-063c3f5208aa{
"status_code": 0,
"result_type": "DRAGON_NLU_ASR_CMD",
... |
Trade-off in Python dictionary key types
Question: Say, I'm going to construct a probably large dictionary in Python 3 for in-
memory operations. The dictionary keys are integers, but I'm going to read
them from a file as string at first.
As far as storage and retrieval are concerned, I wonder if it matters whether
I ... |
Gui for Particlefilter with Python
Question: I'm trying to implement a particle filter and I chose python for it because I
kinda like python. By now i have written my gui using tkinter and python 3.4.
I use the tkinter.canvas object to display a map (png image loaded with PIL)
and then i create dots for each particle ... |
Azure App Insights Authentication with Python Requests
Question: I'm trying to authenticate with Azure AD in order to access the Azure Insights
REST API, so that I can ultimately access Azure web apps. However, [the
authentication example in their documentation](https://msdn.microsoft.com/en-
us/library/azure/dn931949.... |
Python 3 Tkinter - Change state of multiple entries with the same name
Question: Earlier I was having trouble with changing the state of one entry. That was
solved by using `.grid()` on a new line but when I altered this in my program
it only changed one of the entries.
from tkinter import *
def... |
Run system command with no output
Question: I'm running a `wget` in Python via `os.system`.
Is there anyways to hide the output? I tried
> /dev/null
and tried running the command with a `$` in front of it.
Answer: Use the [subprocess](https://docs.python.org/2/library/subprocess.html) module
in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.