text stringlengths 226 34.5k |
|---|
Data append in a list using the previous data in Python
Question: İ need to create a list in Python. It is a little complicated. The list will
contain items which appends according to previous value. For example, suppose
that my list contains
x : 11 (key, value pair)
y : 5
z : 6
if I want t... |
peewee: filter select query results from many to many relationship
Question: I have the following code
#!/usr/bin/env python
"""doc"""
import peewee
db = peewee.SqliteDatabase(":memory:")
class BaseModel(peewee.Model): # pylint: disable=W0232
"""base mode... |
No module named 'x' when reloading with os.execl()
Question: I have a python script that is using the following to restart:
python = sys.executable
os.execl(python, python, * sys.argv)
Most the time this works fine, but occasionally the restart fails with a no
module named error. Examples:
... |
Cythonize two small numpy functions, help needed
Question: # The problem
I'm trying to Cythonize two small functions that mostly deal with numpy
ndarrays for some scientific purpose. These two smalls functions are called
millions of times in a genetic algorithm and account for the majority of the
time taken by the alg... |
Assigning module function returns
Question: I'm relatively new to Python. I'm working on a script that will reassign a
numerical representation of a digit found in a string to its alphabetical
counterpart. Because the function is relatively large in size, I'm adding it
as a module to the script.
I'm having some issues... |
Python secure websocket memory consumption
Question: I am writing a web socket server in python. I have tried the approach below
with txws, autobahn, and tornado, all with similar results.
I seem to have massive memory consumption with secure websockets and I cannot
figure out where or why this might be happening. Bel... |
Complex number troubles with numpy
Question: I'm attempting to translate some matlab code again and I've run into another
pickle. The code itself is very simple, it's just a demonstration of a 4 node
twiddle factor. Here is my attempt:
from numpy import *
from matplotlib import pyplot as plt
... |
Python serialize objects list to JSON
Question: I am trying to serialize to JSON the `__dict__` of an object, which is working
fine, until I append objects to one of the instance attribute of my first
object:
from json import dumps
class A(object):
def __init__(self):
self.b_... |
Internal Server Error with very simple python script
Question: I'm new to python, and i'm trying to run a simple script (On a Mac if that's
important).
Now, this code, gives me Internal Server Error:
#!/usr/bin/python
print 'hi'
But this one works like a charm (Only extra 'print' command)... |
Install libtiff on Mavericks
Question: I made a Python script that needs a libtiff module to run. Do you have any
suggestions on how to install libtiff? I tried to do it using fink, but I got
the following error:
> Failed: no package found for specification libtiff!
I also installed libtiff using brew, and in this ca... |
ipython not producing output graph using matplotlib
Question: SO I have recently started trying to use ipython, I am finding I cannot get it
to produce an output graph. I am running the following code in ipython:
from sklearn import linear_model
regr = linear_model.LinearRegression()
regr.fi... |
'module' object has no attribute 'loads' while parsing JSON using python
Question: I am trying to parse JSON from Python. I recently started working with Python
so I followed some stackoverflow tutorial how to parse JSON using Python and I
came up with below code -
#!/usr/bin/python
import json
... |
Search pandas series for value and split series at that value
Question: Python 3.3.3 Pandas 0.12.0
I have a single column .csv file with hundreds of float values separated by an
arbitrary string (the string contains letters edit: _and will vary run to
run_). I'm a pandas beginner, hoping to find a way to load that .cs... |
issue with self made random number generator in python. (using time.time())
Question: I am well aware that python has a built in random library, so please do not
include any reference to it in this. I am taking a do-it-yourself approach
using `time.time()`. I made a simple random number generator as is shown
below:
... |
how to convert json to python class?
Question: I want to Json to Python class.
example
{'channel':{'lastBuild':'2013-11-12', 'component':['test1', 'test2']}}
self.channel.component[0] => 'test1'
self.channel.lastBuild => '2013-11-12'
do you know python library of json converting?
... |
Ruby script executed by os.system() using python
Question: I am facing issue while writing output of ruby script executed by os.system()
import os
def main():
os.system('\\build.rb -p test > out1.txt')
os.system('\\newRelease.rb -l bat > out2.txt')
if __name__ == '__main__':
... |
paramiko is installed but mysql workbench saying "ImportError: No module named paramiko"
Question: When i tried to open mysql workbench then it saying "ImportError: No module
named paramiko; Operation failed: Cannot start SSH tunnel manager" although i
have installed paramiko. I am using python 2.7.3 ubuntu 12.04
I am... |
Python Homework - file i/o - read file and turn into dictionary
Question: I need to create a function that takes no arguments and reads back the
dictionary that is in a previously-saved file. I must first determine if the
file exists. If it does, I must read the contents of the file and return it as
a dictionary. If no... |
Django get environment variables from apache
Question: I cannot seem to get Django to read the settings I configure from the
environment variables. I have followed some guides online, and found some
other questions, and as a result have tried configuring as below:
**Apache Config:**
WSGIScriptAlias "/v4... |
Sum Values in a Dictionary w/ respect to the Key - Python 2.7
Question: My dictionary `Dict` is arranged as follows. Each key is associated with a
list of values, where each value is a tuple:
Dict = {
'key1': [('Red','Large',30),('Red','Medium',40),('Blue','Small',45)],
'key2': [('Red','... |
Passing numpy array to Cython
Question: I am learning Cython. I have problem with passing numpy arrays to Cython and
don't really understand what is going on. Could you help me?
I have two simple arrays:
a = np.array([1,2])
b = np.array([[1,4],[3,4]])
I want to compute a dot product of them. I... |
How to read from a text file compressed with 7z in Python
Question: I would like to read (in Python 2.7), line by line, from a csv (text) file,
which is 7z compressed. I don't want to decompress the entire (large) file,
but to stream the lines.
I tried `pylzma.decompressobj()` unsuccessfully. I get a data error. Note ... |
Can one declare an abstract exception in Python?
Question: I would like to declare a hierarchy of user-defined exceptions in Python.
However, I would like my top-level user-defined class (`TransactionException`)
to be abstract. That is, I intend `TransactionException` to specify methods
that its subclasses are required... |
Speed of urllib.urlretrieve vs urllib.urlopen
Question: I am trying to download SEC filings directly from the SEC ftp server. When I
use `urllib.urlretrieve(url,dst)`, it takes significantly longer than when
doing something like `page = urllib.urlopen(url).read()` followed by
`writeFile.write(page)`. As an example:
... |
Arithmetic Operation in a SQL query (nested Select statement) using Python
Question: I am trying to do an arithmetic operation in a SQL query using Python (I am
using sqlite3). My SQL Table (TwTbl) has a coloumn geo_count(number). I have
to count the number of entries in which the Geo_count Coloumn has a number
greater... |
Why does SVD result of Armadillo differ from NumPy?
Question: In my Python code, I was computing SVD of some data using
[numpy.linalg.svd](http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html):
from numpy import linalg
(_, _, v) = linalg.svd(m)
V matrix returned by this was... |
python pandas convert dataframe to dictionary with multiple values
Question: I have a dataframe with 2 columns Address and ID. I want to merge IDs with the
same addresses in a dictionary
import pandas as pd, numpy as np
df = pd.DataFrame({'Address' : ['12 A', '66 C', '10 B', '10 B', '12 A', '12 ... |
How to get the size/length of sub-elements within an XML tag using python
Question: I'm newbie to python and I was wondering how to get the size or number of sub
elements within a parent tag lets say `participants`. The idea is to get the
number of `participant` within `participants` tag.
Here is the xml:
... |
Internal server error while running dev_appserver.py
Question: I am trying to upload my Unity Web Player app to Google App Engine but when i
start the server using dev_appserver.py I am getting a Internal server error
while browsing the Localhost page The error The server has either erred or is
incapable of performing ... |
How to insert values of a whole column in python using xlwt
Question: I have found the intersection of two columns in the same excel sheet and I
would like to write the result in a third column in the same sheet using xlwt,
how do I do it? I post the code I am working with below.
import xlrd
import x... |
SWIG c to python lost function?
Question: considering: <https://github.com/dmichel76/ViSi-Genie-RaspPi-Library>
I've tried a serial read and a write, from raspbian to 4d panel, and it all
worked fine.
I 'm trying to use a slider controller, this way it work for one minute then
goes down returning -1 at read.
... |
Problems with importing a python library
Question: Currently I'm trying to use this python library:
<https://github.com/etotheipi/BitcoinArmory/blob/master/armoryd.py>
Essentially, I'm able to run:
python armoryd armory_2BEfTgvpofds_.watchonly.wallet
Only when I pass a .wallet argument.
I want t... |
yaml and compiling libYaml for python under windows
Question: I'm wish to write&read data files ( big size 10mb+ ), I'm thinking about using
using yaml for that. But, after some testing, seems that yaml is extremely
slow in both write and read for file that size. Than I read about libYaml C++,
that speed things up for ... |
Google App Engine: ImportError: No Module named appengine.tools
Question: When running google app engine and trying to import `google.appengine.tools`,
I receive an uncaught exception complaining that `appengine.tools` is
undefined.
I have confirmed that Google SDK is on the PYTHONPATH:
echo $PYTHONPATH... |
Writing python regex that recognizes all unicode letters
Question: There is no [\p{Ll}\p{Lo}\
[1](http://stackoverflow.com/questions/5224835/what-is-the-proper-regular-
expression-to-match-all-utf-8-unicode-lowercase-lette) in python, and I'm
struggling to write a regular expression that recognizes unicode...and doesn'... |
Adding label to an edge of a graph in nodebox opnegl
Question: I am trying to add a label to each edge in my Graph, below:

Basically the above with labels for each edge at the center:

ev.add('dtstart', datetime(2013,11,22,8))
ev.add('dtend', datetime(2013,11,22,12))
ev.... |
how to find what events overlap a date in icalendar in python?
Question: Question is pretty much in the title. I have an event :
from icalendar import Event
from datetime import datetime
# every day from 8am to 12pm
ev = Event(dtstart=datetime(2013,11,22,8), dtend=datetime(2013,11,22,12), rru... |
Webscraping from directory of HTML files using BS4 and python
Question: I have a website in which each person's details are stored in separate .HTML
file. So there are totally 100 person whose details are stored in 100
different .html files. But all have same HTML structure.
Here is the website link <http://www.coimba... |
Python error: unorderable types: list()<int()
Question: I keep getting the error unorderable types: list()< int(). What am i doing
wrong and how should i fix it??
My code:
import sys
from List import *
def main():
strings=ArrayToList(sys.argv[1:])
numbers=ListMap(i... |
matplotlib in gtk window with i18n (gettext) support
Question: I am trying to show a matplotlib plot with axes labeled using gettext's
_("label") construct. Trying to create a minimal example, I came up with the
following python code. It runs fine through the NULLTranslations() like this:
python mpl_i18n_test.py
But ... |
How to log everything into a file using RotatingFileHandler by using logging.conf file?
Question: I am trying to use `RotatingHandler` for our logging purpose in Python. I have
kept backup files as 500 which means it will create maximum of 500 files I
guess and the size that I have set is 2000 Bytes (not sure what is t... |
Python: Importing Modules of Modules
Question: I currently have the directory structure
- module
- __init__.py
- foo.py
- bar.py
I want to use function definitions from both `foo.py` and `bar.py` so have
written this:
import module
module.foo.fooFunct... |
cant get ndb query results
Question: i just started learning python ndb i want to know how can i display students
attending a selected course (filtering Attendance) then mark their attendance
with a ardio button for each student,add the attendance value to the preveious
one and finally save the result back to the datas... |
Scrapy crawl spider stopped working
Question: Prehistory: I'm running Scrapy version 0.16.2 on Python 2.7.2+ and it is on
Linux Mint. A few days ago [I had this
problem](http://stackoverflow.com/questions/20025427/scrapy-crawler-spider-
doesnt-follow-links) and with help I managed to overcome it. For a few moments
Craw... |
AlignIO gives 'AssertionError' when reading emboss alignment files
Question: I have been stuck on a problem for three days... searched everywhere, posted
on [Biostar](http://www.biostars.org/post/edit/87226/), still waiting for EMBL
to respond to emails... would make a bounty if I had more rep.
After aligning sequence... |
How to get the text of a widget/window using python-xlib?
Question: I'm trying to find the whole text that is currently being edited in gedit
window. Firstly i tried to find out the current gedit tab that is focused, by
using Xlib.display. Now i got an Xlib.display.window object . Now i want to
find out the text that i... |
How to encode stream of bits (not bytes) in Python - is any simple module for it?
Question: I want encode and decode **variable** and **countable** stream of **bits**
into **binary string** , **number** , **64 bases encoded string**. Maximum
length of stream will be about 21 + 20 = 41 bits but can be little longer 43,
... |
How can I get the number of lives change (pygame)?
Question: I'm new to python and pygame and so far ive managed to get everything working,
but cant work out how to make my lives go down.
If you haven't worked out its a simple fruit catching game.
I've managed to make my score go up. I've tried saying if the fruit is... |
Send html email with python
Question: I tried to send a email with html text using python.
The html text is loaded from a html file:
ft = open("a.html", "r", encoding = "utf-8")
text = ft.read()
ft.close()
And after, I send the email:
message = "From: %s\r\nTo: %s\r\nMIME-Ve... |
Compatibility with matplotlib, python and pandas on RHEL6
Question: I have a manual install of numpy, matplotlib and pandas, basic tests seem to
work fine.
Versions here:
Numpy 1.8.0
Matplotlib 1.3.1
Python 2.6.6
Pandas 0.12.0
When I run this code on this platform (RHEL 6.4) i get the... |
Using Soundcloud Python library in Google App Engine - what files do I need to move?
Question: I want to use the soundcloud python library in a web app I am developing in
Google App Engine. However, I can't find any file called "soundcloud.py" in
the soundcloud library files I downloaded. When using pip install it work... |
Downloading Links with Python
Question: I have two sets of scripts. One to download a webpage and another to download
links from the webpage. They both run but the links script doesn't return any
scripts. Can anyone see or tell me why?
webpage script;
import sys, urllib
def getWebpage(url):
... |
Django 1.6 upgrade: "cannot import name BaseHandler"
Question: I am trying to upgrade from Django 1.5.5 to Django 1.6. Everything tests fine,
but when I try to run my django project, I get the following error:
ValueError: Unable to configure handler 'mail_admins': Cannot resolve 'vbenergyzone.core.utils.... |
Python string compare error
Question: I am getting the following error when converting my binary d.type_str variable
to 'bid' or 'ask'. Thanks for the help guys! I'm using python 2.7
My code:
from itertools import izip_longest
import itertools
import pandas
import numpy as np
all_t... |
How to make a script execute just after python shell starts and before customuer's input?
Question: In Pythonxy I can edit some python scripts in an pre-defined folder so that
they will be executed (or import? I don't know). For example, if I put a
script in that folder:
import numpy as np
import sci... |
Using python to read text files and answer questions
Question: I have this file animallog1.txt which contains information that i would like
to use to answer questions using python. How would i import the file to
python, which would latter be used I tried
with open('animallog1.txt', 'r') as myfile
b... |
Multiple Files handling with Codependency - Python
Question: I just finished the tutorial for making a rogue-like-game and I'm on my way to
implement freatures.
The problem is, the whole game is a single file with 1k+ lines.
As you can see:
<http://roguebasin.roguelikedevelopment.org/index.php?title=Complete_Rogueli... |
Python CFFI module fails when loading dll: OSError 0x7e
Question: I run Python 3.3 (Anaconda distribution) under Windows 7, 64-bit. I have
attempted to install the Weasyprint app/library, which has a number of
dependencies, including CFFI, which I had to compile from source because no
compatible version of it was avail... |
Python - Pygame Name Error: name 'display_s' is not defined. (bug?) + How do I get variables from inside 'scopes'
Question: recently began working on a pygame project, and came across this error:
Traceback (most recent call last):
File "GameTesting.py", line 50, in <module>
screen.blit(disp... |
Python pygame window keeps crashing
Question: Whenever I run my code the Python Window that shows up does not respond.
Is there something wrong with my code or do I have to re-install pygame and
python?
I get a black pygame window and then it turns white and says not responding?
Also I am new to this so please ma... |
Python how to combine two matrices in numpy
Question: new to Python, struggling in numpy, hope someone can help me, thank you!
from numpy import *
A = matrix('1.0 2.0; 3.0 4.0')
B = matrix('5.0 6.0')
C = matrix('1.0 2.0; 3.0 4.0; 5.0 6.0')
print "A=",A
print "B=",B
print "... |
Unexpected PHP/jQuery/JSON interaction differences
Question: ## Background:
So, I have the following PHP snippet written to help me debug a much larger
problem, but now I'm even more confused as to how jQuery and PHP expect JSON
to be sent/received, as this code does not seem to be doing what I expect:
I want to be a... |
Upgrading from 4.0.4 to 4.0.10 - TypeError: Can't use implementer with classes. Use one of the class-declaration functions instead
Question: I have a (working) Plone 4.0.4 site that uses Dexterity. I am trying to
upgrade it to 4.0.10. When I start an instance on the new (4.0.10) site, I get
the error:
... |
Scapy packet sent cannot be received
Question: I'm trying to send UDP Packets with scapy with the following command:
>> send(IP(dst="127.0.0.1",src="111.111.111.111")/UDP(dport=5005)/"Hello")
.
Sent 1 packets.
And from `tcpdump` I can see:
22:02:58.384730 IP 111.111.111.111.d... |
Why does django/tastypie with postgresql concatenate models_?
Question: I am using postgresql with django and tastypie. I have my models and resources
set up and working with mongodb for certain models and am trying to use
postgresql for relational data models. For some reason, when the query
executes against postgresq... |
Write multiple lists to a JSON file in python
Question: Assume I have the following lists
list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
I can write the first list to a JSON file using
`json.dump(list1,f... |
Python SOAP Client Nested Request
Question: I got a problem with a Python SOAP request. I tested two python SOAP client
libraries so far: SUDS and pysimplesoap. Both work well for the following
example:
from suds.client import Client
from pysimplesoap.client import SoapClient, SoapFault
# su... |
regular expression in python between two words
Question: I am trying to get value
l1 = [u'/worldcup/archive/southafrica2010/index.html', u'/worldcup/archive/germany2006/index.html', u'/worldcup/archive/edition=4395/index.html', u'/worldcup/archive/edition=1013/index.html', u'/worldcup/archive/edition=84/... |
Python i2c write_bus_data usage
Question: 8I have a number of 4 digit seven segment displays that I am trying to control
using Beaglebone Black (running Ubuntu) and i2c.
The SSD's are Byvac BV4614's and the full datasheet [is available
here](http://www.byvac.co.uk/downloads/datasheets/BV4614%20DataSheet.pdf).
I have ... |
Python code for Adding tag in xml where parent tag is multiple with different attributes
Question: I'm parsing the following XML file using `xml.etree.ElementTree`:
<main>
<stream id="1" name="some">
<inner id="500">
<sub-inner>
<inside> 500 </in... |
How do I kill unresponsive threads
Question: I've been trying to find a way to kill the threads that are unresponsive at
the end of this program:
Most of the time the code works, but on certain domains some of the threads
will hang, not allowing the program to complete.
Any help would be much appreciated.
... |
Timing accuracy in Python using WXPython
Question: I'm making a simple mp3 player that plays multiple mp3's at a time. It acts
like it is mixing. Timing is critical to ensure a pleasant user experience,
otherwise it just sounds like two cats trying to solve the mid east crisis. I
need accuracy down to 10ms, and probabl... |
Find exact string in tuple
Question: I am using python to access results from another program. The program has a
specific module in order to so. Unfortunately I do not understand the tuple
format ("stuff") that comes out as a result.
I am familiar with looking up keys/values in dictionaries, but not how this
would wor... |
implementing add and iadd for custom class in python?
Question: I am writing a `Queue` class that wraps list for most of its operations. But I
do not sublcass from `list`, since I do not want to provide all the `list
API's`. I have my code pasted below. The `add` method seems to work fine, but
`iadd` seems to go wrong,... |
django Context syntax error
Question: I'm new to Django and try to create a simple blog, but a syntax error keeps
appearing in the views.py file in the Context line. I use Django 1.6, and the
syntax seems compatible with this version. Here's the simple method from
views.py, where I get the error:
def arc... |
Python AttributeError: 'module' object has no attribute 'atoi'
Question: I tried to run following program of using python 3.2 , there is error:
'module' object has no attribute 'atoi' Can anybody tell me what should I do
to fix this? i really appreciate it !
import string
def converttoint(str):
... |
Sending data Curl/Json in Python
Question: I`m trying to make those 2 requests in python:
Request 1:
curl -X POST -H "Content-Type: application/json" -d '{ "auth_token": "auth1", "widget": "id1", "title": "Something1", "text": "Some text", "moreinfo": "Subtitle" }' serverip
Request 2:
... |
gobject.MainLoop and tornado.IOLoop at once?
Question: How can you run two event loops in one application?
I need to use
[tornado.IOLoop](http://www.tornadoweb.org/en/stable/ioloop.html#ioloop-
objects) (WebSocket client) and
[gobject.MainLoop](http://www.pygtk.org/pygtk2reference/class-
gobjectmainloop.html) (pygtk) ... |
Python tkFileDialog.askdirectory error
Question: i have a following code in python
import Tkinter,tkFileDialog
top=Tkinter.Tk()
from tkFileDialog import askopenfilename
dirname = tkFileDialog.askdirectory(parent=top)
when i print the dirname it appears as normal,and gives
... |
python-social-auth and impersonate django user
Question: I want to avoid store personal information in database (no last names, no
email). This is my approach to achieve it:
1. Delegate authentication to social networks authentication service ( thanks to [python-social-auth](https://github.com/omab/python-social-aut... |
Can't find my error in tt060.py in "Thinking in Tkinter" tutorial
Question: The following code is the source code from the [tutorial "Thinking in
Tkinter"](http://www.ferg.org/thinking_in_tkinter/all_programs.html).
The file is called `tt060.py`, a small tutorial on event binding. Below the
code is the traceback that ... |
How to determine pid of process started via os.system
Question: I want to start several subprocesses with a programm, i.e. a module `foo.py`
starts several instances of `bar.py`.
Since I sometimes have to terminate the process manually, I need the process
id to perform a kill command.
Even though the whole setup is p... |
How to measure execution time of this dinning philosopher program(python)?
Question:
from __future__ import print_function
from threading import Semaphore, Lock, Thread
from time import sleep
from random import random
import argparse
from timeit import Timer
(THINKING, EATING) = (0, 1)... |
tcp socket, select tells writable, but write() blocks
Question: I wrote a little tcp socket server program, using select() to check if a
client socket is writable. If the client is writable, I will write data to it.
The client is written in Python, for testing only, it connect to the server,
and never read from the co... |
Python: Associating Function Output to Strings, then Combining into Dictionary
Question: I have a list of computer nodes called node_names, and I want to find the
amount of free ram in each node, and store that in a second list. I then want
to combine these lists into a dictionary.
I have:
for i in rang... |
Perl's Inline::Python fails on pyephem
Question:
#!/bin/perl
use Inline Python;
$s = new Sun();
print "SUN: $s\n";
$m = new Moon();
__END__
__Python__
from ephem import Sun as Sun;
from ephem import Moon as Moon;
The code above yields:
SU... |
Python os.geteuid() for windows
Question: I saw that os.geteuid() is only available for unix, how to replace its usage
in windows. I needed this because celery is using the function and for celery
to run in windows I need this function alternative for windows. Please do
help.
Answer: User id in Windows? I'm not sure
... |
How to reconstruct Python function from memory address?
Question:
>> def spam():
... print("top secret function")
...
>>> print(spam)
<function spam at 0x7feccc97fb78>
>>> spam = "spam"
So I lose the reference to `spam` function. Can I get it back from that memory
address: 0x7feccc97fb... |
"Optional feature not implemented (106) (SQLBindParameter)" error with pyodbc
Question: I'm being driven nuts trying to figure this one out. I'm using Python for the
first time, and trying to write data collected from twitter out to an Access
2010 database.
The command I'm using is:
cursor.execute('''in... |
Python module: how to prevent importing modules called by the new module
Question: I am new in `Python` and I am creating a module to re-use some code. My module
(`impy.py`) looks like this (it has one function so far)...
import numpy as np
def read_image(fname):
....
and it is stored i... |
How to make list of datetimes using rrule
Question: I am creating my own .ics parser.
I am using icalendar python module. It works great but I would like to get
list of datetimes for events which have RRULE set.
I have starting date as datetime object instance and RRULE parsed like this:
CaselessDict({... |
python generator endless stream without using yield
Question: i'm trying to generate an endless stream of results given a function f and an
initial value x so first call should give the initial value, second call
should give f(x), third call is f(x2) while x2 is the previous result of f(x)
and so on..
what i have come... |
from past import print_statement
Question: Is there some equivalent to `from __future__ import print_function` that
forward-ports the `print` statement from python 2.x?
An answer involving some `ipython` magic that lets me print without need of
surrounding parens during prototyping is also acceptable.
Answer: Some s... |
Python Pandas: How to filter a dataframe with more than one expression stored in different variables?
Question: I am building a multy purpose User Interface, and I am adding Pandas to it.
For this, I need to form expressions by components (stored in variables) which
are defined by users choices.
All seems to work fine... |
How to check size of the files in a directory with python?
Question: I have a folder that contains 4 text files. I want to program a code with
which I would be able to check the size of the files in my folder and only
open those that has equal sizes. Anyone has any idea?
I have already tried this
import... |
API tkinter python entry
Question: I have a problem with the entry. I want the user to write in any city they
want in the
API link. I get that i cant convert to a str. So when ever the user choose to
enter a city he can just click on the button forecast after he entered the
city in the Entry and the weather will be p... |
P4Python - p4.run_changes returning empty list
Question: The following code printing empty list "[]".I am expecting list of all change
list between the date range specified. What do I need to fix to get the change
list?
from P4 import P4,P4Exception
p4 = P4()
p4.port = "perforce:1666"
p4... |
Converting a string representation of an array to an actual array in python
Question: Hi doing some stuff over a network and wondering if there is any way of
converting python array as a string back into a python array.. for example
x = "[1,2,3,4]"
converting x to
x_array = [1,2,3,4]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.