text stringlengths 226 34.5k |
|---|
Can convert Tkinter inputs into numbers
Question:
__author__ = 'Feuer'
from tkinter import *
root = Tk()
root.geometry("750x400")
def stop():
exit()
def plus():
global erg11
erg11 = z1 + z2
class Start:
def __init__(self, ma... |
Socket issue when using threads
Question: I've been working on a python game in my spare time, and I've run into a
problem. I'm working with sockets using the basic threads module, and it works
fine when I connect to the server file with one client. But more than that,
and any that connect after the first freezes up th... |
Convert Linux's curl program to a python code
Question: I need to convert the following curl program to equivalent python program and
also want to know how to store the response of this request which is a csv
file in python.
curl --data-binary @obama.txt
"<http://www.sentiment140.com/api/bulkClassify?query=obama>"
Th... |
How to call function from class in python, answer must be in links but dont get it
Question: Im using a function I downloaded somewhere however its not a function but a
class and I have no clue how to call it. This is aproximately how it looks,
say this is examplefile.py:
class exampleclass:
someva... |
Python how can i get the timezone aware date in django
Question: I am using delorean for datetime calculation in python django.
<http://delorean.readthedocs.org/en/latest/quickstart.html>
This is what i am using
now = Delorean(timezone=settings.TIME_ZONE).datetime
todayDate = now.date()
But i... |
Execute multiple statement on MySQLdb cursor
Question: I want to execute multiple statement on a MySQLdb cursor over a database with
**MyISAM** storage. I followed every other way explained in this
[answer](http://stackoverflow.com/questions/5669878/python-mysqldb-when-to-
close-cursors) and else where, with not succes... |
Check if second script is running or already finished
Question: I need to check if a `scriptA.py` is still running, in `scriptB.py`. Both are
started individually, but `scriptB.py` may only continue if `scriptA.py` is
still running.
I know I could use
import subprocess
process = subprocess.Pope... |
MAXscript Listener can not run Pyside
Question: Please help me !
I'm creating GUI by Python can run on the 3Ds Max, i heard someone said i have
to use Pyside to make it. And everthing be fine until now.
This is my code :
import sys
from PySide import QtGui
from PySide.QtGui import *
from Py... |
multiprocessing broken pipe after a long time
Question: I develop a crawler using multiprocessing model.
which use multiprocessing.Queue to store url-infos which need to crawl , page
contents which need to parse and something more;use multiprocessing.Event to
control sub processes;use multiprocessing.Manager.dict to s... |
pprofile.Profile().print_stats() display in IPython
Question: I tried pprofile to profile Python code line by line.
import pprofile
profiler = pprofile.Profile()
I printed the statistics to the Ipython console using
profiler.print_stats()
This works, however, the plotted ta... |
Is it better practice to pass sometimes complex dicts for parameters instead of parameter objects?
Question: I've been programming Python for a year now, having come from a Java
background, and I've noticed that, at least in my organization, the style for
passing complex parameters to functions is to use dicts or tuple... |
Combining nested collection in mongodb with documents written from parallel nodes
Question: I'm in the process of figuring out whether I can use MongoDB to help with our
storage and processing issues. The idea is that computation will be done on
each node in a multi-processed way and written to mongodb with a unique
mo... |
Enable Cython profiling for whole program?
Question: The Cython docs say "Profiling in Cython is controlled by a compiler
directive. It can be set either for an entire file or on a per function basis
via a Cython decorator."
Is there any easy way to enable Cython profiling for an entire Python program?
That is, is the... |
Python Dataset package & looping / updating rows --
Question: I am trying to retrieve the contents of my sqlite3 database and updating this
data utilizing a scraper in a for loop.
The presumed flow is as follows:
* Retrieve all rows from the dataset
* For each row, find the URL column and fetch some additional (updat... |
Python cursor based reading and returning for large data following OOP structure
Question: In my situation, I have a main processing Python script that creates a class
(FileIterator) which will iterate through a large data file line by line.
class FileIterator:
def read_data(self, input_data... |
How to "pretty print" a python pandas DatetimeIndex
Question: I am new to pandas and still amazed by what it can do, although sometimes also
by how things are done ;-)
I managed to write a little script which will report on the number of missing
values encountered in a timeseries, either in each month or in each year ... |
Bad reloc address 0x0 in section.data C extensions for python
Question: I'm trying to write a script to automate a device in python. The device is
programmed in C and I'm currently attempting to write a C wrapper in order for
me to call those functions from Python later. I'm following
[this](http://csl.name/C-functions... |
Frequency analysis of values produced by generator
Question: I'm doing some analysis of images, and I have a generator that gives me all
pixels in image:
def pixels_g(img):
w, h = img.shape
for y in range(0, h):
for x in range(0, w):
yield img[y][x]
It's ... |
Python Float Lost with Big Numbers
Question: I am working with some large numbers and have run into a problem with lost
floating values.
When multiplying large numbers, the float portion seems to go missing, lost,
becomes zero. When using the same code with smaller numbers, this does not
happen.
Trivial example:
... |
How do I send NLTK plots to files?
Question: I'm using NLTK to create dispersion plots and do a few other things. Trouble
is, I have to manually close the window that creating a dispersion plot opens
to get the code to continue running. How can I send the plot to a file and
keep the script moving? I assume I'll have th... |
Python: generate xlsx in memory and stream file download?
Question: for example the following code creates the xlsx file first and then streams it
as a download but I'm wondering if it is possible to send the xlsx data as it
is being created. For example, imagine if a very large xlsx file needs to be
generated, the use... |
Python: add a variable to the scope of an imported function
Question: Consider the following situation:
#module.py
def test():
foo = bar+'foo'
print foo
if __name__ == '__main__':
bar='test'
test()
The main file is:
#main.py
import module
... |
Merging records from two '.CSV' files in python
Question: I have two '.csv' files in the below format: First File :
Roll_num Class_Name
1 ABC
2 DEF
5 PQR
27 UVW
Second File :
Roll_num Marks Grade
1 75 A
2 60 C... |
Python parsing html for complete links urls
Question: I have to parse a html page looking for links in it. Unfortunately, the links
don't contain the full url (for instance starting with
"<http://www.example.com/aResource.html>"). So my parsing get only the
relative URL, for get the whole url address i'm using
... |
Cannot insert an image into HTML document
Question: I know this is a very basic question, but it is driving me crazy.
I am trying to insert an image ("logo_footer.png") in an HTML document that I
am working on. It is a Python web app and I am using the TurboGears 2
Framework.
I have tried several different methods, a... |
In Python, why doesn't 'y = x; y += 1' also increment x?
Question: First create a function for displaying reference count (note that we have to
-1 each time to get the correct value, as the function itself INCREF-s the
argument)
>>> from sys import getrefcount as rc
>>> x=1.1
>>> rc(x)-1
1
... |
Asyncore client in thread makes the whole program crash when sending data immediately
Question: I write a simple program in python, with asyncore and threading. I want to
implement a asynchorous client without blocking anything, like this:
[How to handle asyncore within a class in python, without blocking
anything?](h... |
How to speed up process of loading and reading JSON files in Python?
Question: I am running a script (in multiprocessing mode) that extract some parameters
from a bunch of JSON files but currently it is very slow. Here is the script:
from __future__ import print_function, division
import os
from ... |
Python please tell me if my maths answer is right
Question: I wish to add a feature which tells the user when he/she has answered
correctly to the random maths questions that are given.
import random
def answers():
correct_answer_P_ = ((str(difficulty_one + difficulty_one))) #P = PLUS, A... |
How to gzip the result while writing in Python?
Question: I am parsing some code and writing the result into 11 text files but the
problem is that my ssd cannot afford the normal sizes . that is why I am
looking for a way to write the results in a gzipped format.any idea?
my code:
from __future__ import... |
Python : How to call dictionnary-contained callables at a given time?
Question: I'm working with a dictionary object in python which contains numerous keys.
Some of their associated value type is of callable type.
Something like :
dico = {
'key1' : 1,
'key2' : 'cars',
'key3' : <b... |
How should a clock object be made in Python?
Question: I'm making a very simple clock object in Python. I want to be able to
instantiate a clock giving it a name and have it record the time it is running
for, with pause functionality. I think I've nearly got it, but the pause
functionality is giving me some trouble -- ... |
Python: Custom sort a list of lists
Question: I know this has been asked before, but I have not been able to find a
solution.
I'm trying to alphabetize a list of lists according to a custom alphabet.
The alphabet is a representation of the [Burmese
script](http://en.wikipedia.org/wiki/Burmese_alphabet) as used by [Sg... |
Python - efficient way to search file names based on multiple filters
Question: I have a small bit of code to list file names that match a filter string. I'm
trying to extend this to match against multiple filters. I have some working
code which takes a very straight forward loop approach but it is
sloooooooow.... basi... |
get perfomance date from cloudstack api
Question: Please help me in getting date about perfomace hipervizor using simple api (in
my case i used python).
There is simple example who gets list of machines :
#!/usr/bin/python
import CloudStack
api = 'http://example.com:8080/client/api'
... |
Fastest Way To Round Number Inside List of Strings Python
Question: Given a list (can be numpy array) of addresses:
>input: ['F/O 1751 HOBART PL NW', '11TH ST NW 2301', '801 MT VERNON ST NW']
where the number doesn't always occur at the same place in the string. Is
there a faster way than first ext... |
How do you make a unique map key in Python?
Question: I want to make a map containing various attributes of a single item and share
it across several modules. The most obvious answer is to use a string, but
since the map will be used across several modules, I don't want maintainers to
have to know about all existing at... |
Does python zlib library support uuencode?
Question: My python code is trying to decompress a uuencoded file using the zlib
library. Here is the code snippet:
self.decompress = zlib.decompressobj(wbits)
.
.
buf = self.fileobj.read(size)
.
.
uncompress = self.decompress.decompress(... |
Python set update with iterable
Question: What I have at hand is a text file of decent size (~ 23MB). I am reading the
file line by line and extracting a few words from each line based on some
external criteria. For the sake of this example, let's say each line contains
at least half a dozen tab-separated values and I ... |
Applying a regular expression to a text file Python 3
Question:
#returns same result i.e. only the first line as many times as 'draws'
infile = open("results_from_url.txt",'r')
file =infile.read() # essential to get correct formatting
for line in islice(file, ... |
Python (Tkinter) - canvas for-loop color change
Question: I generated a grid using a for-loop in Tkinter, but want to know how I would
be able to bind an on-click function to such that when I click on each
individual generated rectangle, the rectangle will change color.
from Tkinter import *
mas... |
Python module error:Randint
Question:
from random import randint
This is the code I've used to import the Random module. When I run the code,
it instead imports a file of mine for testing code called **random.py**. This
was leading to all sorts of errors, so I 'permanently' deleted it in the
Recycle Bin and ... |
How to clear python console (i.e. Ctrl+L command line equivalent)
Question: OS = Linux
[boris@E7440-DELL ~]$ uname -a
Linux E7440-DELL 3.17.4-200.fc20.x86_64 #1 SMP Fri Nov 21 23:26:41 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
From python console (Spyder 2.2.4, Python 2.7.5 64bits, Qt 4.8.5) it i... |
Where can I locate the library for python base functions in Linux?
Question: I am mainly trying to get examples from the library of the base functions to
help aid me in my studies of Python. I am running Linux Mint 17 and I would
like to simply know the path to the base functions, so I can open them and
view the Python... |
Define writable method in asyncore client makes sending data very slow
Question: I wrote a asynchorous client using python asyncore, and met some problems. I
have solved this with the help of this:
[Asyncore client in thread makes the whole program crash when sending data
immediately](http://stackoverflow.com/question... |
Google App Engine Python -> configure yaml and websockets
Question: I`m beginning programmist with google API working in python. I have pycharm
3.4.1 version.
I 'm trying to make a project (backend) of game bomberman. It is like i have
to use content of already written game in javascript. I have my project folder
and ... |
How to convert API timestamp into python datetime object
Question: I am getting the following string from an API call:
s = '2014-12-11T20:46:12Z'
How would I then convert this into a python object? Is there an easy way, or
should I be splitting up the string, for example:
year = s.sp... |
Convert datetime obj to timezone-aware datetime
Question: I have the following date I am trying to save:
timestamp = datetime.datetime.strptime(timestamp_raw, '%Y-%m-%dT%H:%M:%SZ')
When I save it, I get the following Warning:
/Library/Python/2.7/site-packages/django/db/models/fields/... |
how to access the first result of a google search result ( prominently a video link)?
Question: [https://www.google.co.in/search?q=black+sabbath+%E2%80%93+iron+man&oq=black+sabbath+%E2%80%93+iron+man&aqs=chrome..69i57.461j0j4&sourceid=chrome&es_sm=122&ie=UTF-8](https://www.google.co.in/search?q=black+sabbath+%E2%80%93+... |
Python : which importing module is calling my function at runtime
Question: I don't know if there is a way to get the information I want, so maybe there
isn't. Anyway, here is my question:
I have a module, say "m.py", with a function , say "def f(): ..."
Now imagine some other modules are importing m.py
in f, I woul... |
Determine which Radiobutton has been selected
Question: I am sorry for the silly question but there doesn't seem to be too much
documentation on this that is understandable.
So far I have this:
self.firstRadioButton = Radiobutton(self.__canvas, text="ONE", fg='white', bg=BACKGROUND_COLOR, variable=self.... |
How to fix ImportError: No module named packages.urllib3?
Question: I'm running Python 2.7.6 on an Ubuntu machine. When I run `twill-sh` (Twill is
a browser used for testing websites) in my Terminal, I'm getting the
following:
Traceback (most recent call last):
File "dep.py", line 2, in <module>
... |
Fast Fourier Transform for Harmonic Analysis
Question: I'm analyzing the harmonics present in the wave motion as a function of where
along the string the pluck occurs. I hope to obtain a plot like those
exhibited on this page:
<https://softwaredevelopmentperestroika.wordpress.com/2013/12/10/fast-fourier-
transforms-wit... |
Django Query Natural Sort
Question: Let's say I have this Django model:
class Question(models.Model):
question_code = models.CharField(max_length=10)
and I have 15k questions in the database.
I want to sort it by _question_code_ , which is alphanumeric. This is quite a
classical problem an... |
Pyplot colormap line by line
Question: I'm beginning with plotting on python using the very nice pyplot. I aim at
showing the evolution of two series of data along time. Instead of doing a
casual plot of data function of time, I'd like to have a scatter plot
(data1,data2) where the time component is shown as a color gr... |
How to make subprocess run for 60 sec
Question: I have the following python script that runs. I want is to run the subprocess
to run for 60 sec and then send the SIGINT signal to subprocess and write the
output in file.If i use sleep the subprocess doesn't run.
#!/usr/bin/python
import os
import ... |
Scala - best API for doing work inside multiple threads
Question: In Python, I am using a library called `futures`, which allows me to do my
processing work with a pool of N worker processes, in a succinct and crystal-
clear way:
schedulerQ = []
for ... in ...:
workParam = ... # arguments fo... |
Install dpkt on python 3
Question: I am trying to install dpkt on python 3 and I get the following error when I
am installing:
(venv)[root@miura dpkt-1.8]# python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
import dpkt
File "/root/dpkt-... |
Python How to convert 8-bit ASCII string to 16-Bit Unicode
Question: Although Python 3.x solved the problem that uppercase and lowercase for some
locales (for example tr_TR.utf8) Python 2.x branch lacks this. Several
workaround for this issuse like <https://github.com/emre/unicode_tr/> but did
not like this kind of a s... |
Why my Python regular expression pattern run so slowly?
Question: Please see my regular expression pattern code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
print 'Start'
str1 = 'abcdefgasdsdfswossdfasdaef'
m = re.match(r"([A-Za-z\-\s\:\.]+)+(\d+)\w+", str1) # Wan... |
python script showing error in php execution
Question: I am using executing a `python script` in php , but it is showing an error
`ValueError: invalid literal for int() with base 10`: 'param2' ,whereas it is
running fine from terminal.
here is my code :
$String = "Hello there, how are you.";
$no_of_... |
Msgpack on Cloudant
Question: I am trying to use msgpack with Cloudant, and I couldn't find any
documentation on it.
2 years ago, Tim Anglade [present msgpack as a wonderfull way to pack your
data instead of
JSON](https://www.youtube.com/watch?feature=player_detailpage&v=zEMfvCqVL4E#t=887
"CouchDB & Ruby: You're Doing... |
How to use Pygtk in a C/C++ application?
Question: I would like to integrate a simple Pygtk window in a C/C++ application (The
reason being a previously designed GUI in pyGtk is to be integrated into a
bigger GTK+ (in C) application)
I get Segmentation fault error
Here what i did :
=====> In python (tmp.py):
... |
Tango With Django: User Authentication - User being saved but not receiving confirmation
Question: I am on chapter 9 of Tango With Django:
<http://www.tangowithdjango.com/book17/chapters/login.html#demo>
Whenever I create a user, I get an error page on my browser as shown below:
IntegrityError at /... |
Parsing text with regex in Python: determine match order and mapping value to object type?
Question: I'm attempting to use an 'estate description' field to obtain information
regarding different houses as an exercise for learning python. What I'm
interested in (what a lot of sites do _not_ show) is how many rooms there... |
How to flatten a list of tuples into a pythonic list
Question: Given the following list of tuples:
INPUT = [(1,2),(1,),(1,2,3)]
How would I flatten it into a list?
OUTPUT ==> [1,2,1,1,2,3]
Is there a one-liner to do the above?
Similar: [Flatten list of Tuples in
Python](http:/... |
how can I save the output of a search for files matching *.txt to a variable?
Question: I'm fairly new to python. I'd like to save the text that is printed by at this
script as a variable. (The variable is meant to be written to a file later, if
that matters.) How can I do that?
import fnmatch
import... |
get integer from textfile and write to excel with python
Question: I already get the value from text file and write it to excel file. But somehow
in the excel cell the integer written in string. So there's a green triangle
in the cell. Like this 
I w... |
Python regex alternative for join
Question: Suppose I have a string `string = 'abcdefghi'` and I want the output as `'a-b-
c-d-e-f-g-h-i'` I can easily use `'-'.join(string)` and get the required
output. But what if I want to do the same using regex? How would I do the same
using regex?
I am asking because I'm learnin... |
Python And Random Forest Algorithm
Question: I'm trying to use Python's Random Forest ML (machine learning) algorithm with
a *.csv file, and this is information is inside that *csv.file
DateTime;Status;Energy
28-02-2014 19:30:00;True;10,1
28-02-2011 06:15:00;False;15,6;
28-02-2011 06:30:00;Fa... |
How to start a python program recursive with os.execv?
Question: I have the following lines:
#!/root/p34/bin/python
import os
import sys
for i in range(10):
print(i)
currentFile = os.path.abspath(__file__)
print(currentFile)
os.execv(currentFile, sys.argv)
... |
Please help me in debugging this python code
Question: This is a program that finds anagrams for words greater than 15
letters.There's no syntax error but the output is not as expected.I will be
extremely grateful if u could point out the logical error in the program. I
downloaded the word list from <http://thinkpython... |
Django Rest Framework 3.0 to_representation not implemented
Question: I'm upgrading from Django Rest Framework 2.4 to 3.0.1 using Django 1.7.1 and
Python 2.7 and can't get past the following error:
File "/Users/bjacobel/.virtualenvs/hey/lib/python2.7/site-packages/rest_framework/fields.py", line 375, in ... |
My program crashes(python.exe has stopped working)
Question: So i've made a project for school, and it won't run and i have no idea why.
Everytime i press the "start" button i made, the whole program freezes and
stops working, and seeing as i've made a similar program earlier(this one is
just much cleaner) i get really... |
How can I get the proper capitalization for a path?
Question: Let's say I have a class which represents a directory (simplified example of
course):
import os
class Dir:
def __init__(self, path):
self.path = os.path.normcase(path)
To make things easier to implement internally... |
Python 2.2.3 HTTP Basic Authentication Implementation
Question: I am trying to implement the HTTP Basic Authentication in Python 2.2.3. This
is code:
import urllib2
proxyUserName1='<proxyusername>'
proxyPassword1='<proxypassword>'
realmName1='<realm>'
proxyUri1='<uri>'
passm... |
python socket, how to receive all the message when buffer is not big enough?
Question:
# addition_server.py
import socket
buf_size = 4
host = ''
port = 8000
server_addr = (host, port)
def get_msg(soc):
msg = ''
while True:
temp = soc.recv(buf_... |
How does `tkinter. Spinbox()` behaviour depends on the type of value passed to its `textvariable`
Question: Been trying to pick up on Python (3.4) and this is my first posting on Stack
Overflow. I have questions regarding the behaviour of the `textvariable`
option in the `tkinter.Spinbox()` widget constructor.
The fol... |
How to update a label in Tkinter, StringVar() not working
Question: I am working on this short code that compares the single characters of two
strings. After the first running, when I change the strings in the
entryBoxes,I would like to replace the label created before, instead of
creating a new one. I have already tri... |
How to import sqlite3 in my python3.4 successfully?
Question: There are two python version in my debian7, one is python2.7 the system
default version, the other is python3.4 which compiled to install this way.
apt-get update
apt-get upgrade
apt-get install build-essential
wget http://www.... |
Python. Django - How to call a python function when submitting form with Ajax
Question: I have an error when loading the app which says that url in form's _action_
attribute is not correct. I've googled for several hours and tried different
variants, still no result. I'm totally new to django and would appreciate any
h... |
Redirect screen output to text file
Question: My python script calls an executable (binary compiled from C++) like this:
subprocess.call(["./rti", '1', '0.05', fileForRTI])
where `rti` executable name, `1`, `0.05` and `fileForRTI` are arguments.
This executable generates output to the console, but... |
handling command output in python
Question: I want to work with the output of a wifi scan command. The output is several
lines and I am interested in 2 information out of it. The goal is to have the
ESSID and the address in a two dimmension array (hope thats right?) Here is
what I got so far:
#!/usr/bin/... |
How to end Tkinter propbably if not using the Quit button
Question: I tried to find out a solution for my problem, but I couldn't find one. I am
using Python27 on Windows 7.
I have an easy Tkinter GUI with a button:
import Tkinter
import sys
def close_window():
root.destroy()
... |
application folder not showing up on sys.path [Python]
Question: I have a web application that I am developing on my local machine. I copy over
the files to my server, and now my program will not run.
I examined the sys.path on both machines and on my server (where the code wont
run) i am missing the top-level directo... |
Portable code: __import__ parameter string type between Python 2 and Python 3
Question: What should I do, in a world where all text literals are Unicode by default,
to make `__import__` work in both Python 2 and 3?
I'm slowly learning about making Python code that will run under both Python 2
(version 2.6 or above) an... |
How to properly implement tkMessageBox in Python3.4?
Question: I want to launch a warning using tkMessageBox in Python3. This warning is
supposed to launch when a user doesn't select an element from a listbox.
Unfortunately whenever I try to implement message box it does not launch like
it is supposed to. I have code f... |
running time of python program is very small in ubuntu as compare to windows. why?
Question: I implemented [Dijkstra's
algorithm](http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) in Python and
ran the script under Ubuntu and windows 8. Both x64 architecture.
I profiled the script using `python -m cProfile name.py`... |
df.to_sql gives TypeError with dtype=sqlalchemy.timestamp(timezone=True)
Question: I'm trying to use DataFrame().to_sql to input a time aware dataframe series.
Here is an example of my code.
times = ['201412120154', '201412110254']
df = pd.DataFrame()
df['time'] = pd.to_datetime(times, utc=T... |
Zed Shaw exercise 20 doesn't work
Question: When I type this below:
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):
print line_count, f.readline()
... |
Installing pydot and graphviz packages in Anaconda environment
Question: I want to be able to create graphical decision trees in Python, and I am
currently trying to install both `pydot` and `graphviz`.
I am using Anaconda as my environment (along with Spyder), and have tried to
run the following lines of code
... |
Python Pyserial read data form multiple serial ports at same time
Question: I'm trying to read out multiple serial ports at the same time with Python 2.7
and PySerial.
Features should be:
1. in the main program I get all open serial ports, open them and append the serial object to serialobjects
2. I want to read... |
Migrate an existant project from Django 1.6 to 1.7
Question: I have a project running Django 1.6 with Python 2.7 and, for several reasons,
I would like to upgrade to Django 1.7.
Consider that South has never been used in this project and that we have a
custom user model (this is important to keep in mind because custo... |
Extracting data from xml format in python
Question: I have the following nmap output as xml format:
<ports><extraports state="closed" count="991">
<extrareasons reason="conn-refused" count="991"/>
</extraports>
<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="... |
Python pandas - filter rows after groupby
Question: For example I have following table:
index,A,B
0,0,0
1,0,8
2,0,8
3,1,0
4,1,5
After grouping by `A`:
0:
index,A,B
0,0,0
1,0,8
2,0,8
1:
index,A,B
3,1,5
4,1,3
What I need is... |
Is HTTP Post blocked by Cloud9?
Question: I've been playing around with Python/Flask on Cloud9 ide. Pretty fun so far.
But when I try to add a http post to my test project, Flask returns either a
403 or a 500. From what I can tell, when I attach data or send the POST
method, the 'request' object is None. It doesn't mak... |
Syntax error in if statement Python
Question: For some reason I get a syntax error on this function.
def log(user, successful):
if successful == True:
with open('userlog.txt', 'a') as logfile:
logfile.append(datetime.datetime + ' User ' + user + ' Logged in'
else:
with... |
python: using file handle to print contents of file
Question: I am following this advice: [File as command line argument for argparse -
error message if argument is not
valid](http://stackoverflow.com/questions/11540854/file-as-command-line-
argument-for-argparse-error-message-if-argument-is-not-va) to print the
conten... |
Python: Why "__all__" doesn't work for import?
Question: File structure;
./__init__.py
a.py
/lib
__init__.py
Foo1.py # contains `class Foo1`
Foo2.py # contains `class Foo2`
# so on ...
Tested this in `a.py` and worked, doing this;
from li... |
Handle multiple messages with Queue get()
Question: Thanks to @user5402 for the previous
[solution](https://stackoverflow.com/questions/27487207/how-to-run-a-thread-
more-than-once-in-python/27488251?noredirect=1#comment43421261_27488251).
I am trying to handle multiple messages that are queued up. Here is the code:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.