text stringlengths 226 34.5k |
|---|
Python typeError
Question: I am new to programming. I am trying to download race results using Python and
Mechanize. I tried to loop through the pages by creating a `for` loop I have
included the relevant code below. When I run this I get the following error:
TypeError: unsupported operand type(s) for %: 'instance' an... |
Firefox doesn't restore server-sent events connection
Question: Test case implemented with Python and CherryPy:
import cherrypy, time
class Root():
@cherrypy.expose
def index(self):
return r'''<!DOCTYPE html>
<html>
<head>
<title>Server-sent events... |
scipy.polyfit(x, y, 100) would be 100th order polynome, but matplotlib.pyplot.legend displays 53?
Question: I'm having a hard time figuring out why my plt.legend displays the wrong
polynome degree. It says 53 instead of 100. My code would go like this:
import scipy as sp
import numpy as np
import... |
need to pass python vars to bash avconv command
Question: bash hacker here getting my feet wet with python. I have almost ported one of
my bash scripts to python, but I cannot seem to figure out how to pass python
vars to the bash command avconv to convert .ogg audio files to .mp3 files
(_sigh_ mp3 player does not play... |
Why return anything but `self` from `__iadd__`?
Question: Python's [documentation on the methods related to the in-place
operators](http://docs.python.org/3/reference/datamodel.html#object.__iadd__)
like `+=` and `*=` (or, as it calls them, the _augmented arithmetic
assignments_) has the following to say:
> These meth... |
Django ManyToManyField FieldError in second app - Cannot resolve keyword 'xxxx into field
Question: I'm trying to write an application where users can submit photos. Part of this
involves voting for photos. So in my models.py I have:
`photos/models.py`
class Photo(models.Model):
votes = models.I... |
Python reading unicode from local files
Question: I am trying to read some unicode files that I have locally. How do I read
unicode files while using a list? I've read the python docs, and a ton of
stackoverflow Q&A's, which have answered a lot of other questions I had, but I
can't find the answer to this one.
Any hel... |
.xlsx and xls(Latest Versions) to pdf using python
Question: With the help of this [.doc to pdf using
python](http://stackoverflow.com/questions/6011115/doc-to-pdf-using-python)
Link I am trying for excel (.xlsx and xls formats)
**Following is modified Code for Excel:**
import os
from win32com impor... |
Using eval in Python 2.7.3 to solve a maths expression
Question: I am essentially asking if I should use eval in this situation for Python
2.7.3;
**The Actual Question (for understanding read the content below)**
I am essentially asking whether approach 1 is better or approach 2 is better
for this context. I believe ... |
accessing clipboard via win32clipboard
Question: I am working on a project in which i have to continuouly check clipboard
content. If clipboard content matches with certain specified data, then it
should be deleted from clipboard. After doing a lot of googling, I find out
that it can be done easily by win32clipboard ap... |
Is there a example in django 1.6 and python 3 to build a accounts app (include:register , login , and logout )
Question: I do have read the offical document, but it describes every facility
separately, after reading 'User authentication in Django' ,'First steps' ,
'The model layer', 'The view layer' and 'The template l... |
How to setup a 'catch all' view in Python Pyramid to log incoming requests for static files?
Question: For debugging purposes I'm trying to see what static files(css, js, jpg, etc)
files are being requested from my html files. I read the docs here: [enter
link description
here](http://docs.pylonsproject.org/projects/py... |
Wait for callback function to return in Node.js
Question: I'm able to spawn a Python child_process and write the data returned from
Python to the console in Node. However, I'm not able to return the data in a
callback function in Node. I’m thinking this is because the callback function
is asynchronous, so the server re... |
Python -- list comprehension with try/exception and nested conditional
Question: This code should find the mode of a list in O(n) linear time. I want to turn
this into a list comprehension because I'm teaching myself Python, and am
trying to improve my list comprehension skills.
These were informative but don't reall... |
Cannot import Twython
Question: I installed Twython 1.2 using the Windows installer at this link:
<https://pypi.python.org/pypi/twython/1.2>. The installer seems to run fine.
I get the error "ImportError: cannot import name Twython" when I try to do:
from twython import Twython
from twython import T... |
Python curses: addstr() from file prints blanks for the remainder of the line
Question: I'm writing a very simple farming game in Python using curses. At this point I
have been successful in allowing the player (just a "@" character) to move
around within a window.
I have a few files with ascii-art that I print to the... |
Create an input box with python
Question: I want to create a box for the user to interact with on screen.
I want to use it like this:
The program runs. A window appears. The box is somewhere in that window. And
the user can click inside with the mouse. He can type, erase, and when he is
done he will be able to press ... |
lxml returns an empty list on DTD attributes
Question: I'm trying to get the attributes of a DTD element to get their default values
but attributes() is returning always an empty list. Here is the code:
#!/usr/bin/python3 -BEOObbs
# coding=utf-8
import io, lxml.etree
xml = lxml.etre... |
Python not decoding json
Question: I am receiving the error:
No JSON object could be decoded: line 1 column 0 (char 0)
when trying to parse a json object returned from the xbox music api.
Here is my code:
conn = httplib.HTTPSConnection(SERVICE_API)
conn.request("GET", url)
r... |
Can't create sqlite database on Windows XP with Django Python 2.7
Question: I need to create an SQLite database with Django and Python 2.7.
However, when I run "python manage.py syncdb", I receive:
unable to open database file
Here is a fragment of settings.py file:
import os
... |
Python - getting source code with socket
Question: I wanna send http get request and receive source code from webpage, this has
to be done through sockets. I set buffer size to 4096, but my script download
only small part from the page
import socket
sock = socket.socket ( socket.AF_INET, socket.SOCK_... |
Multiplication program
Question: I am making this multiplication program in python 2.7.5 for my sister, and I
don't know how to count the correct answers. Here is the code:
import easygui
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
answer = easygui.enterbox("What is " + str(i) + ' times 8?')
... |
How to get each Process ID when multiprocessing
Question: I have some problems because I'm newbie in Python and Pyside.
I have N processes which are running at the same time.
Since these processes take some times to finish their job, it's possible that
end user wants to cancel a specific process. So I need a way to k... |
Drop Down Menu In Python calling information from files
Question: So I need a drop down menu, where the user picks his/her client, and it
returns information about that client.
lets say i have a file:
["client1", "client2", "client3"]
and I have this code:
from tkinter import *
... |
Const correctness of Python's C API
Question: It seems that the Python C API is not consistent with the const correctness of
character arrays. For example,
[PyImport_ImportFrozenModule](http://docs.python.org/2/c-api/import.html#PyImport_ImportFrozenModule)
accepts a `char*`, whereas
[PyImport_ImportModule](http://docs... |
How to set background color of a column in a matplotlib table
Question: I have multile .txt files in a directory, say,
d:\memdump\0.txt,1.txt,...10.txt sample text file is given below:
Applications Memory Usage (kB):
Uptime: 7857410 Realtime: 7857410
** MEMINFO in pid 23875 [com.example.twolibs... |
How to get back an overridden python built-in function?
Question: When I was exploring a solution for the StackOverflow problem, [Python Use
User Defined String Class](http://stackoverflow.com/questions/20884949/python-
use-user-defined-string-class), I came with this strange python behavior.
def overrid... |
How to find elements of a list are subset of string using python
Question: I am a Molecular Biologist and new to programming, so excuse me for my
language. I am working with python.
Example:
string = "gctatagcgttatatactagcctatagctata"
list = ["gtagctaggac", "mptalltruiworw", "12365478995", "nvn... |
error with gdalbuildvrt, in Python
Question: I am new to python/GDAL and am running into perhaps a trivial issue. This may
stem from the fact that I don't really understand how to use GDAL properly in
python, or something careless, but even though I think I am following the help
doc, I keep getting a syntax error when ... |
Python Set Lookup Efficiency
Question: I'm aware that python sets have O(1) lookup time and python lists have O(n)
lookup time, but I'm curious about the container size at which it becomes
worthwhile to convert a list to a set.
In other words, if I were to call the below:
arr = [1, 2, 3]
for i in ra... |
Python - Extracting files from a large (6GB+) zip file
Question: I have a `Python` script where I need to extract the contents of a ZIP file.
However, the zip file is over 6GB in size.
There is a lot of information about `zlib` and `zipfile` modules, however, I
can't find a single approach that works in my case. I hav... |
What magic prevents Tkinter programs from blocking in interactive shell?
Question: _Note: This is somewhat a follow-up on the question:[Tkinter - when do I need
to call mainloop?](http://stackoverflow.com/questions/8683217/tkinter-when-do-
i-need-to-call-mainloop)_
Usually when using [Tkinter](http://docs.python.org/3... |
Facebook Python " ValueError: too many values to unpack"
Question: I am new to programing and Python..
Below is my code.
import csv
import json
import urllib
import sys
import time
import re
class FacebookSearch:
def __init__(self,
query = 'https://grap... |
How to show hashtag - tweepy?
Question: I want to see all the tweets that have a specific hashtag. I wrote the code
like this:
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
ckey = 'xxx'
csecret = 'xxx'
atoken = 'xxx'
ase... |
Interpolation ignoring zero values in array - Python
Question: I have two arrays of the same length
x = array([-243., -242., -241., -240., -239., -238., -237., -236., -235.,
-234., -233., -232., -231., -230., -229., -228., -227., -226.,
-225., -224., -223., -222., -221., -220., -219... |
subprocess.check_ouput is hanging up in eclipse and not taking backup for pg_dump in python langauage
Question: postgres dump is not working properly, i run the below python program through
eclipse with linux(ubuntu) background OS.
The problem is eclipse get hanged up and trace information as well as backup
file is em... |
How to Write Python Script in html
Question: I want to execute my python code on the side even though there might be
security problem
How can I write with importing modules and all? I have tried using of pyjs to
convert the below code to JS `import socket print
socket.gethostbyname_ex(socket.gethostname())[2][0]` but ... |
selenium 2- python- cannot import webdriver even though selenium is up to date
Question: Im trying to use selenium in python 2.7 and when trying to import webdriver it
gives me the error "ImportError: cannot import name webdriver" Ive had a
search around and people seem to say updating it should sort the problem which
... |
How to extract method using Suds in Python
Question: I want to extract all the methods and want to send some parameters using how
can I do automation using python.
I want only methods as user input and send parameters to the method. How can I
achieve this?
from suds.client import client
url="name fo... |
How to use a variable in a module from the script that called the module
Question: I would like to make a plugin system for my script.
**How plugins are loaded**
The plugins are python modules stored in a specified folder.
I import the modules with this code:
class Igor:
# ...
... |
Getting console.log output from Chrome with Selenium Python API bindings
Question: I'm using Selenium to run tests in Chrome via the Python API bindings, and I'm
having trouble figuring out how to configure Chrome to make the `console.log`
output from the loaded test available. I see that there are `get_log()` and
`log... |
Styling with classes in Pyside + Python
Question: How can I better style this app using classes rather than redefining the same
styles for every label that should look the same. It makes it a pain to change
a style because I then have to go through every label that is suppose to look
the same and paste the code to matc... |
Calling configuration file ID into Linux Command with Date Time from Python
Question: I'm trying to write a script to get the following outputs to a folder
(YYYYMMDDHHMMSS = current date and time) using a Linux command in Python, with
the ID's in a configutation file
1234_YYYYMMDDHHMMSS.txt
12345_YYY... |
how to get nested tags with a loaded html page using python or php?
Question: How to do it?
How to get nested tags with a loaded html page using python or php?
Could you give me maybe a site where I can learn?
from HTMLParser import HTMLParser
import urllib
class MyHTMLParser(HTMLParser):
... |
python conversion of two dimensional list of float to two dimensional array of float
Question: I am trying to read a column of float into a list for each of a set of CSV
files, then appending to a two dimensional list, later converting that to a 2D
array, but the array doesn't convert into a two dimensional array of fl... |
Setting PYTHONPATH environment variable in Visual Studio C++
Question: I have a C++ program which imports a Python module, along the lines of this
snippet:
#include <Python.h>
char python_module[] = "my_module";
Py_Initialize();
PyObject* pName;
pName = PyString_FromString(pytho... |
how to trap the value error in python
Question: If any file is corrupted and cannot be open, the following code raise value
error and stop opening of further files. How can I print out the name of the
file which raised value error, and make the program to run further to detect
and print out next file which raise value ... |
How to add modules from a custom repository that isn't a package? python
Question: I have tried to use `sys.path.append()` with `os.getcwd()` but it didn't work.
The source was from [**here**](https://github.com/alvations/DLTK) and I've
downloaded and extracted them as such:
alvas@ubi:~/test$ wget https... |
Python argparse example?
Question: I'm trying to learn argparse in order to use it in my program, the syntax
should be like this:
-a --aLong <String> <String>
-b --bLong <String> <String> <Integer>
-c --cLong <String>
-h --help
I have this code:
#!/usr/bin/env python
... |
ImportError: cannot import name SSLError
Question: I need the SSLError utility function but ...
from requests.exceptions import SSLError
and I get ImportError: cannot import name SSLError :(
PS: I have installed python-requests in Ubuntu using the python-requests
package
Answer: Your `requests` ... |
Pyint tip 'Unable to import <module>'
Question:
testproject/src/pkga/pkgb/pkgc/module.py
testproject/test/pkga/pkgb/pkgc/module_test.py
src and test is the source folder,
src/pkga and test/pkga is the root package
in file module_test.py
from pkga.pkgb.pkgc import module
pylint... |
Scrapy Spider for JSON Response
Question: I am trying to write a spider which crawls through the following JSON
response:
[http://gdata.youtube.com/feeds/api/standardfeeds/UK/most_popular?v=2&alt=json](http://gdata.youtube.com/feeds/api/standardfeeds/UK/most_popular?v=2&alt=json)
How would the spider look if I would w... |
Numba error: NotImplementedError: Unable to cast from { i64, i8* }* to { i64, i8* }
Question: I am getting a strange error with numba.
I am using Anacondas, Python 3.3
The function I am trying to autojit is
@autojit
def _generate_broadcasted_forecasts(self):
x = np.array( self.residuals[1:]... |
What does it mean to put a dot in a Python class argument?
Question: In Python, I saw a class definition as the following:
from protorpc import messages
# Create the request string containing the user's name
class HelloRequest(messages.Message):
my_name = messages.StringField(1, requ... |
Python - Time delta from string and now()
Question: I have spent some time trying to figure out how to get a time delta between
time values. The only issue is that one of the times was stored in a file. So
I have one string which is in essence `str(datetime.datetime.now())` and
`datetime.datetime.now()`.
Specifically,... |
Syntax error while parsing Json data in javascript
Question: I am returning this in my views.py through a dictionary
{"injured_json": [{"pk": 24, "model": "appvisual.injured_count", "fields": {"Y_2010": 75445, "Y_2008": 70251, "Y_2009": 70504, "Y_2004": 57283, "Y_2005": 62006, "Y_2006": 64342, "Y_2007": ... |
Urllib2.urlopen python chinese in windows
Question: I'm making a little scrip in python. The objective is to make a request to a
page that returns a Json file and work with the information. The problem is
that I need to work with chinese words in the urls. When I make the request
with (for example):
f = ... |
Module name conflict in Python, how to resolve?
Question: I came across a file in our project, called - wait for it - celery.py. Yes,
and celery.py imports from the installed celery module (see
<http://www.celeryproject.org/>) which is not an issue because the project's
celery.py uses
from __future__ imp... |
How to modify an html tree in python?
Question: Suppose there is some variable fragment html code
<p>
<span class="code"> string 1 </ span>
<span class="code"> string 2 </ span>
<span class="code"> string 3 </ span>
</ p>
<p>
<span class="any"> Some text </ span>
... |
How to run test suite in python setup.py
Question: I am trying to setup a Python package using `setup.py`. My directory structure
looks like this:
setup.py
baxter/
__init__.py
baxter.py
tests/
test_baxter.py
Here is `setup.py`:
from setuptools import setup, ... |
Matching something or the end of the content
Question: How can I ask to look for a word followed by `%`, this special character being
optional if the word is at the end of the text to analyze ?
The following code prints only `showme` but I would also like to have `metoo`.
#! /usr/bin/env python3
... |
Auto-indenting graphviz .dot file
Question: I am working on a long and complex architectural graph. The document
indentation mixes tabs, spaces and indentation levels, which drives me crazy.
**Is there a simple way to automatically indent graphviz`.dot` files in Linux
environment?**
A pure command line tool would be ... |
subprocess.call() for shell program which write a file
Question: I need to execute a shell script using python. Output of shell program is a
text file. No inputs to the script. Help me to resolve this.
def invokescript( shfile ):
s=subprocess.Popen(["./Script1.sh"],stderr=subprocess.PIPE,stdin=subp... |
Finding full pathname in a Python trace
Question: When turning on Python trace, the filename is provided, along with the module
and sourcecode.
Is it possible to show the file path as well as the filename?
I am using:
-m trace -t
In the example below there are two different **account_bank_stateme... |
python: how to cast a list to c_byte array
Question: I have a c function in dll.
It has a interface like `int dcm(char inmsg[], int length);`
Now I have a list like(the number of member are more than 1000 sometimes)
a = [0x41,0x00,0x00,0xC8,0x08,0x01,0x03,0x00,0x00,0x02,0x10,0x00,0x66,0x62,0x05,0x00,0x... |
manage.py help has different python path in virtualenv
Question: I have a problem in virtualenv that a wrong python path is imported.
The reason is that by running the command:
`manage.py help
--pythonpath=/home/robert/Vadain/vadain.webservice.curtainconfig/`
The result is right, but when I run `manage.py help` then... |
How to sort Counter by value? - python
Question: Other than doing list comprehensions of reversed list comprehension, is there
a pythonic way to sort Counter by value? If so, it is faster than this:
>>> from collections import Counter
>>> x = Counter({'a':5, 'b':3, 'c':7})
>>> sorted(x)
['a',... |
An elegant way to use a resource in Python?
Question: I want to find an elegant way to do the following:
try:
with some_resource:
# got it
do_something()
except ResourceUnavailableError:
# didn't get it
do_something_else()
This:
1. tries t... |
Creating a syntax highlighter in python(PyQt4)
Question: I've been searching the internet about the **Syntax highlighting** of a
particular file in a text editor and i read about **Lexers and Yacc**. i'm
quite confuse about the concepts on syntax highlighting.
I've created a simple text editor using **PyQt4** and i wa... |
Paramiko: ssh.exec_command to collect output says open channel in response
Question: I have python script with paramiko and ssh somewhat as below
import paramiko
# setup ssh connection this works. no problem.
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPoli... |
/usr/lib/python2.7/subprocess.py OSError: [Errno 2] No such file or directory
Question: I'm trying to use MEGAM with NLTK.
This is my code:
import nltk
import os
megam_path = os.path.expanduser("~/nltk_data/megam_i686.opt")
nltk.config_megam(megam_path)
me_classifier = MaxentClassifier.t... |
Dealing with Unicode range in Python
Question: I am trying to test if a given string is within the Katakana range or not.
I tried the solution asked here : [Python and Unicode Blocks for
regex](http://stackoverflow.com/questions/3145232/python-and-unicode-blocks-
for-regex). But still, my output is "None". What am i m... |
How do I get warnings.warn to issue a warning and not ignore the line?
Question: I'm trying to raise a `DeprecationWarning`, with a code snippet based on the
example shown in the docs.
<http://docs.python.org/2/library/warnings.html#warnings.warn>
Official
def deprecation(message):
warnings.warn... |
python multiprocessing: why is process defunct after terminate?
Question: I have some python multiprocessing code with the parent process starting a
bunch of child worker processes and then terminating them after awhile:
from multiprocessing import Process
nWorkers = 10
curWorkers = []
f... |
'str' object is not callable,how to deal?
Question: when I'm trying to run my python-django app, the error says: 'str' object is
not callable
I've tried the solution here but not worked for me: [TypeError: 'str' object
is not callable
(Python)](http://stackoverflow.com/questions/6039605/typeerror-str-object-is-
not-c... |
A faster way to evaluate 2D-array items than nested for loops?
Question: I'm using python 2.7
I have a 2-dimensional array that is several hundred elements on each axis.
Each element is either '0', or '255' I need to look at each element and write
a '0' or '1' into a different array that has the same dimensions. Curre... |
Scrapy key error
Question: I am having issues creating the Scrapy spider in the Scrapy tutorial:
<http://doc.scrapy.org/en/latest/intro/tutorial.html#our-first-spider>
Here is what I have in my spiders/dmoz_spider.py file:
class DmozSpider(object):
name = "dmoz"
allowed_domains = ["dmoz.org... |
QGLWidget don't move its contents on scroll
Question: I'm using Qt from python with PySide bindings. The main part of my application
is the OpenGL view that can be resized to particular value (this is a
simulator for testing my game in different resolutions of mobile devices). I
use QGLWidget to render graphics from my... |
IndexError in unused conditional
Question:
def menurender():
global pos
global menulist
line1=menulist[pos]
if pos == len(menulist):
line2="back"
else:
line2=menulist[pos+1]
lcd.clear()
lcd.message(str(pos)+' ' +line1+ "\n"+str(pos+1)+' '+ line2)
In my bloc... |
Python Tkinter Toplevel
Question: I am working on a program that requires multiple windows, and the first one to
appear is the login window, I used the Toplevel widget in order to make other
windows its children, but this code keeps showing two windows instead of one.
from Tkinter import Frame, Toplevel
... |
Print all fields of ctypes "Structure" with introspection
Question: test.c:
#include <stdio.h>
#include <stdlib.h>
struct s {
char a;
int b;
float c;
double d;
};
struct s *create_struct()
{
struct s *res = malloc(sizeof(struct s));
... |
How to decrement an entire csv column with Python - what am I doing wrong?
Question: I am very new to programming so please be patient with me.
I am reading from a .csv like so:
1, -2
2, 3
3, -6
4, 5
5, 7
and so on. My goal here, essentially is just to delete the first row, and the... |
Python TCP socket.recv() returns with nothing as soon as connection is made
Question: I'm trying to implement the most basic python TCP server. Windows 8, Python
2.7, firewall is turned off. Code is from here:
<https://wiki.python.org/moin/TcpCommunication>
If I do the client stuff (`socket(...), connect(...), send(..... |
Python: time.sleep functions unexpectedly?
Question: I'm trying to make a simple function that will type out a string letter by
letter, such as in a game, where text scrolls.
Here's what my code looks like:
import time
def ScrollingText(s):
s=str(s)
for letter in s:
... |
Python-random number and its frequency
Question: > The function `randint` from the random module can be used to produce random
> numbers. A call on `random.randint(1, 6)`, for example, will produce the
> values 1 to 6 with equal probability. Write a program that loops 1000 times.
> On each iteration it makes two calls ... |
Numpy loadtxt Behavior change with Python 3
Question: I have some code that has been working fine in Python 2.7 using numpy's
loadtxt function to read in a csv file into a numpy array. The file can be
seen [here](http://www.andrewhowe.com/INDEX_20140101.csv). I use this command
inp = numpy.loadtxt(filen... |
Python: io.TextIOWrapper illegal newline
Question: I'm trying to set the newline character for SiRF binary messages, but the IO
wrapper doesn't seem to accept the newline chars.
Code:
import serial
import io
port = serial.Serial(port='/dev/ttyUSB0', baudrate=4800, timeout=2)
sio = io.Te... |
How to find visible bluetooth devices in Python?
Question: I need to find the list of visible Bluetooth devices with their respective
details in the range of my Bluetooth modem. I only need to do Bluetooth 2.0
and below. I don't need to do Bluetooth 4.0.
Like you do on an Android phones using "Search for devices".
I'... |
Create a half circle in angle 45 in Python
Question: I need to create a half circle in angle 45 (a moon) , of radius 20 in the left
side of a pic. I'm new to the image processing in Python. I've downloaded the
PIL library, can anyone give me an advice? Thanks
Answer: This might do what you want:
import... |
No module named lxml.html while running python script on Fedora
Question: I'm trying to run a python script on Fedora Server. I'm getting the following
error.
/usr/bin/python report_generation.py
Traceback (most recent call last):
File "report_generation.py", line 9, in ?
import lxml.html
... |
Pig game in Python
Question: I'm trying to write a pig game in python. Here is my code:
from random import *
roll_q = raw_input('would you like to roll')
if roll_q == (' yes'):
while True:
num1 = randint(1,6)
print str(randint)
if randint == 1:
... |
Python/PyGame functions not working as hoped
Question: I have this project to create a game with a main menu. I have created a very
basic main menu at the moment just for prototype purposes. I have my main menu
load up and then i want to hit "f" to play game, but it's not working as
hoped. When i launch it the g It was... |
How to load all entries in an infinite scroll at once to parse the HTML in python
Question: I am trying to extract information from [this
page](https://medium.com/top-100/december-2013). The page loads 10 items at a
time, and I need to scroll to load all entries (for a total of 100). I am able
to parse the HTML and get... |
Sending an Email with Python Issue
Question: I have this code and I cannot seem to get it to work. When I run it, the
script doesn't finish in IDLE unless I kill it manually. I have looked all
over and rewritten the code a few times, and no luck.
import smtplib
SMTP_SERVER = 'smtp.gmail.com'
... |
C DLL to Python Callback
Question: I have a Visual C++ DLL. I have a SetCallback( function-pointer) exported in
the DLL. I use this function to set a callback function from a python2.7
script. I follow what is given in the Python documentation.
from ctypes import *
def mypy_callback(number):
... |
Is it possible to emit valid YAML with anchors / references disabled using Ruby or Python?
Question: Is it possible to disable creating anchors and references (and effectively
list redundant data explicitly) either in `PyYAML` or Ruby's `Psych` engine?
Perhaps I missed something while searching the web, but it seems t... |
Import python packages that have similar internal module names, by full path
Question: In my project I need to import two external packages from two different full
paths.
When I had only one external package, I added its path to `sys.path` and it
worked, I could do that for both of the package but unfortunately both
p... |
how to fix "AttributeError: 'module' object has no attribute 'set_binary' "?
Question: i compiled mercurial successfully as follows: ...
copying build/scripts-2.7/hg -> /usr/local/bin
changing mode of /usr/local/bin/hg to 755
running install_egg_info
Writing /usr/local/lib/python2.7/site-pack... |
How to ZIP an Excel file using python?
Question: How can I zip a excel file using python ? I have a excel sheet. I want to
change ZIP the excel Sheet Using Python. So that It can have less network
usages when I try to download from mine Site. Just Another Requirements.
Thanks in Advance.
Please Help
Answer: Python... |
How to get input of arguments from the terminal along with the filename in python?
Question: For example if I want to compare two numbers(compare which is greater, for
example) and get this input from the terminal in linux along with the
filename.
Like:
python myfilename.py 2 3
This program should... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.