text stringlengths 226 34.5k |
|---|
entering console inputs from within python file
Question: In my python file, I have made a GUI widget that takes some inputs from user.
I have imported a python module in my python file that takes some input using
raw_input(). I have to use this module as it is, I have no right to change it.
When I run my python file, ... |
adding lines in C code using Python script
Question: I need to calculate the execution time of a loop in C code and for that i need
to write a python script that adds "gettimeofday" before and after the loop by
detecting the comments before and after the loop.
Here is the code:
int main(int argc, char**... |
Setting up Emacs24 for python development
Question: I want to configure Emacs24 for python development. So far I've fallowed the
instructions in [this blog post](http://www.yilmazhuseyin.com/blog/dev/emacs-
setup-python-development/) and done all the steps successfully, but nothing
happened when I reopened Emacs. It's ... |
Django: New class added in model.py not showing in admin site
Question: I'm a front-end dev struggling along with Django. I have the basics pretty
much down but I've hit at wall at the following point.
I have a site running locally and also on a dev machine. Locally I've added an
extra class model to an already existi... |
The included urlconf xxxx.urls doesn't have any patterns in it
Question: I want to get an url in a modelform class. I have seen in [The included
urlconf manager.urls doesn't have any patterns in
it](http://stackoverflow.com/questions/6482573/the-included-urlconf-manager-
urls-doesnt-have-any-patterns-in-it). But **reve... |
How to decrypt ciphertext using openssl in C?
Question: How do I able to decrypt a cipher text which is encrypted using AES in python.
Encrypt.py
Using this I made cipher text using AES and concatenated that with the IV and
wrote that in to a file file.txt.
from Crypto.Cipher import AES
import hash... |
Django model export on MySql server
Question: I imported the external database into my project , thereby converting it to
`models.py` file using `python manage.py inspectdb > models.py` command.
Now I have edited the models.py file by adding another class. How can I export
the `models.py` file onto the MySql server wi... |
TypeError: decoding Unicode is not supported python
Question: I am using lxml.html to parse an html file and get the text from the page. Bur
now I have a string which has a character `'` for example `Florian's` due to
which, while printing the output I get traceback
parent_link_id_text = parent_link_id.... |
Creating a keyword based search in python
Question: I have a giant CSV file with close to 6K entries and the file looks something
like this:
PDB ID NDB ID Structure Title Citation Title Abstract
1ET4 1ET4 Structure of Solution structure Research was performed and
... |
How to convert multiple lists to dictionaries in python?
Question:
['*a*', '*b*', '*c*', '*d*', '*f*','*g*']
['11', '22', '33', '44', '', '55']
['66', '77', '88', '', '99', '10']
['23', '24', 'sac', 'cfg', 'dfg', '']
need to put in dictionary as:
{a : ('11','66','23'),b : ('22','77... |
Python sub process call
Question: What i am trying to accomplish in a few words is this: change directories and
call script from shell.
So far so good i have managed to change directories with `os.chdir()` .
However i haven't been able to understand how to syntax the second part of the
given task. Specifically, the c... |
Editing a duplicate list edits the original
Question: So I've started a simple sort of roguelike game project in python, but I have
problems with editing a duplicate list editing the original. The code is as
follows:
charx = 1
chary = 1
level = [["#","#","#","#","#","#","#"],["#",".",".",".",".",... |
Scapy problems when importing modules
Question: I recently started programming in python and scapy. But when i use from
scapy.all import * it doesnt work and i get the exception ImportError: No
module named 'base_classes'. So it is finding the folder all, but cannot find
base_classes. I verified however that base_class... |
System Paths and Modules
Question: I have the following setup:
/project/
/api/
__init__.py
test.py
/modules/
__init__.py
api.py
I am trying to, from the /project/ directory, run api.py: `python
modules/api.py`
The api module attempts ... |
how to add path with module to python?
Question: I try to build V8 javascript engine. When I try to invoke the command `python
build/git_v8`, I get error:
File build/gyp_v8, line 48 in < module >
import gyp
ImportError: No module named GYP
How I can tell python where search GYP module ... |
Python 2.7, pygame, combing pause and unpause button.
Question: I am coding a simple music player.
I have searched the other questions in Stackoverflow, however, the solutions
do not work with my pygame build.
My code is below. I am using Tkinter for the gui build.
import sys
from Tkinter import *
... |
Calling a method from a parent class in Python
Question: Can anyone help me with the correct syntax to call my method
`__get_except_lines(...)` from the parent class?
I have a class with a method as shown below. This particular method has the 2
underscores because I don't want the "user" to use it.
NewP... |
pip not installing to site-packages directory from within virtualenv when I use a requirements.txt
Question: I'm relatively new to running Python with virtualenv so this might be an easy
fix, but I can't for the life of me figure out what's going on. I'm running
Windows 7 professional x64 with Python 2.7.5 installed I ... |
tf-idf using data on unigram frequency from Google
Question: I'm trying to identify important terms in a set of government documents.
Generating the term frequencies is no problem.
For document frequency, I was hoping to use the [handy Python scripts and
accompanying data](http://norvig.com/ngrams/) that Peter Norvig ... |
Display a georeferenced DEM surface in 3D matplotlib
Question: I want to use a DEM file to generate a simulated terrain surface using
matplotlib. But I do not know how to georeference the raster coordinates to a
given CRS. Nor do I know how to express the georeferenced raster in a format
suitable for use in a 3D matplo... |
matplotlib agg ticks when rendering floating points
Question: This is the same problem as here: [python odd axis ticks,
matplotlib](http://stackoverflow.com/questions/16895980/python-odd-axis-ticks-
matplotlib). Except no one is following that question so to make it little
clearer:
I'm using a Linux machine:
... |
AttributeError: 'module' object has no attribute 'ClassType'
Question: Ok so I've been trying to type the command: python but it ends up spitting
this out:
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 62, in <module>
import os
File "C:\Python27\lib\os.py", l... |
Python: encode special charecter
Question: I'm trying to encode a string containing '-' (minus) symbol to iso8859-15, it
will return the string as it is. for eg:
str="abc-def"
Expected output is
abc%2Ddef
Is there any way to do this? sorry me if my question is wrong.
Answer: ... |
How to calculate how much Ip Addresses have between two Ip Addresses?
Question: I have two Ip Addresses, and I want to count how many Ip Addresses there are
in the range between the two.
Example:
IP_START = "127.0.0.0"
IP_END = "127.0.1.1"
SUM_OF_IP_ADDRESS = 257
Does anyone know... |
Hashlib: optimal size of chunks to be used in md5.update()
Question: This is in reference to [Get MD5 hash of big files in
Python](http://stackoverflow.com/questions/1131220/get-md5-hash-of-big-files-
in-python) and [Hashlib in Windows and
Linux](http://stackoverflow.com/questions/4418042/hashlib-in-windows-and-
linux)... |
Why does python allow an empty function (with doc-string) body without a "pass" statement?
Question:
class SomeThing(object):
"""Represents something"""
def method_one(self):
"""This is the first method, will do something useful one day"""
def method_two(self, a, b):
... |
Cast an object to a derived type in Python
Question: I want to cast an object of type A to type B so I can use B's methods. Type B
inherits A. For example I have class my class B:
class B(A):
def hello(self):
print('Hello, I am an object of type B')
My Library, Foo, has a functi... |
Does numpy.ma allow masking of sub-masked arrays in a masked array?
Question: I am writing some code in Python 2.7 (using pydev in eclipse, Mac OSX) to
gather information about a big set of card information stored in xml files.
The cards are from Magic the gathering and all have a very similar card
structure (Name, cos... |
Python urllib2 - cannot read a page
Question: I am using `urllib2` in `Python` to scrape a webpage. However, the `read()`
method does not return.
Here is the code I am using:
import urllib2
url = 'http://edmonton.en.craigslist.ca/kid/'
headers = {'User-Agent': 'Mozilla/5.0'}
reques... |
Unbind default button behavior in wxPython
Question: I am writing an interface where I'd like to have a user click a button, then
capture his next keystroke.
I can currently capture all the keys on the keyboard, except for those like
tab or the arrow keys which cause the button to lose focus when pressed. I
know that ... |
python csv reader selecting specific rows
Question: Suppose we have a text file as given below:
sfgsdgfs >sfsf > "assfgs.jpg">sggw.sgw
sgsdfghsg>sdgsgsgsg[]
werw>"erqwer.jpg">egfwrewrw
How to extract the rows that contain .jpg? What is wrong with the following
code?
import cs... |
Calculate Similarity of Sparse Matrix
Question: I am using Python with numpy, scipy and scikit-learn module.
I'd like to classify the arrays in very big sparse matrix. (100,000 * 100,000)
The values in the matrix are equal to 0 or 1. The only thing I have is the
index of value = 1.
a = [1,3,5,7,9]
... |
displaying graph after importing txt file matplotlib
Question: I am writing a simple program to output a basic graph after importing a text
file. i get the following error:
Traceback (most recent call last):
File "C:\Users\Chris1\Desktop\attempt2\ex1.py", line 13, in <module>
x.append(int(x... |
python multi thread to process file with fcntl flcok
Question: I try to use python to handle text replace problem. There is a file of Little-
endian UTF-16 format, I want to replace the ip address in this file. First, I
read this file by line, then replace the target string, last, I write the new
string to the file. Bu... |
solve an n-dimensional optimisation probl using iminuit
Question: I woul like to solve an n-dimensional optimisation problem using iminuit.
So my approach is the following. I am trying to figure out how to extend this:
def f(x,y,z):
return (x-1.)**2 + (y-2*x)**2 + (z-3.*x)**2 -1.
to a vari... |
Is a general-purpose function/object doubling decorator feasible in Python?
Question: **Background:** Let's say that we have a function that opens a frequently-used
database connection, something essentially like the following but with
additional bells and whistles:
import getpass
import MySQLdb... |
python: create and update a datetime field in a sqlite db
Question: I have a data structure that I'm iterating through:
SomeList = [[ID, VarA, VarB, DateC, VarD],[ID2, VarA2, VarB2, DateC2, VarD2]...]
The DateCX variables will always be of the form:
"2013-07-15T13:58:55Z"
I've... |
Trouble accessing JSON data in Python for loop
Question: I can read in the JSON data and print data but for some reason it is reading
it in as unicode so I cannot use the simple dot notation to get at the data.
test.py:
#!/usr/bin/env python
from __future__ import print_function # This script requir... |
Setuptools setup.py installing when dependencies not satisfied
Question: I have a `setup.py` that looks a bit (okay, exactly) like this:
#!/usr/bin/env python
from setuptools import setup
import subprocess
import distutils.command.build_py
class BuildWithMake(distutils.command.b... |
Python style: use imported class as namespace for related custom data?
Question: I was wondering if it's ok to use an imported, 3rd-party class as a namespace
for you related custom variables? Say, the following code:
import pycurl
curlm = pycurl.CurlMulti()
curlm.pool = [pycurl.Curl() for i... |
Python 2: SMTPServerDisconnected: Connection unexpectedly closed
Question: I have a small problem with a sending Email in Python:
#me == my email address
#you == recipient's email address
me = "some.email@gmail.com"
you = "some_email2@gmail.com"
# Create message container - the corre... |
Recursive function gives no output
Question: I'm scrapping all the URL of my domain with recursive function. But it outputs
nothing, without any error.
#usr/bin/python
from bs4 import BeautifulSoup
import requests
import tldextract
def scrap(url):
for links in ... |
Play 2 sounds simultaneously with multiprocessing in python
Question: I need to play 2 sounds simultaneously, with multiprocessing rather than
threads, to see if it solves a problem where threads play the audio in
sequence rather than in parallel. I am guessing it's due to the Global
Interpreter Lock (GIL) in python.
... |
How do I catch a 404 error in urllib? (python 3)
Question: I've been reading tens of examples for similar issues, but I can't get any of
the solutions I've seen or their variants to run. I'm screen scraping, and I
just want to ignore 404 errors (skip the pages). I get
_'AttributeError: 'module' object has no attribute... |
Socket echo server in go
Question: I'm trying to implement a simple socket echo server in go this is the code:
package main
import (
"fmt"
"net"
"sync"
)
func echo_srv(c net.Conn, wg sync.WaitGroup) {
defer c.Close()
defer wg.Done()
... |
What is the fastest way to do I/O in Python?
Question: Like those programming challenges, right now I do the following:
For a single variable:
x = int(sys.stdin.readline())
for many variables
A, B, C = map(int,sys.stdin.readline().split())
Is this optimal or are there faster w... |
Python Printing A List Issue
Question: I'm really struggling to work out how to print to a list. I'd like to print
the server response codes of URLs I specify. Do you know how I'd alter to code
to print the output into a list? If not, do you know where I'd find the
answer? I've been searching around for a couple of wee... |
Getting a list of values from a list of dict in python: Without using list comprehension
Question: I have a list of dict for example,
[{'id': 1L, 'name': u'Library'}, {'id': 2L, 'name': u'Arts'}, {'id': 3L, 'name': u'Sports'}]
Now, I have to retrieve the following list from this dict without using... |
Running webapp2 app in a multiple WSGI apps set up with Werkzeug
Question: I am trying to run a django app and a webapp2 app together in one python
interpreter. I'm using werkzeug for that as described
[here](http://flask.pocoo.org/docs/patterns/appdispatch/).
Here's my sample code.
from werkzeug.wsgi i... |
Return a Dynamic png from Pylons
Question: What I'm trying to do is have my Pylons app dynamically generate an image
based on some data, and return it in such a way that it can be viewed in a
browser.
So far I am generating my image like this:
import Image, ImageDraw
image = Image.new("RGB", (width,... |
tkinter progress bar with file list
Question: I have a loop that read files in python like below:
def Rfile():
for fileName in fileList:
….
How can I add a tkinter progress bar that will be linked to the for loop and
the size of the fileList (start before the loop and close after the lo... |
Using a text file to receive a string for a variable in Python, without defining it
Question: I have a text file in which there are several variables. Most of them are used
in a Bash script of mine, but I'd like to use the same text file for my Python
script. For the lines that are not properly formatted for Python, I ... |
mixing pixels of an image manually using python
Question: I am trying to create an algorithm that blends the pixels of an image and I
can bring the image as it was before, but I do not know do this.
I'm using python and pil, but I can use other libraries.
Exemple:  file (>1Gb)
on a server.
I have a form in html :
<form enctype="multipart/form-data" action="upload.py" method="post">
<p>File: <input type="file" name="file"></p>
<p><input type="submit" ... |
What are \xHEX characters and is there a table for them?
Question: When reading a textfile, I read these characters, when printed out to console
it outputs blanks or �:
['\x80', '\xc3', '\x94', '\x99', '\x98','\x9d', '\x9c', '\xa9', '\xa6', '\xe2']
What are these \xHEX characters? Is there a link t... |
Python-twitter api.VerifyCredentials() returns none
Question: I am using python-twitter api and i got consumer_key, consumer_secret,
access_token_key, access_token_secret but when i try code below i got this
output {} for `print api.VerifyCredentials()` and i got none for `print
status.text`
import twitt... |
Python: run through all integer combinations subject to a constraint (find the minimum of a function)
Question: I would like to find a way to return the set of all vectors [x_1,...,x_n]
subject to the constraint x_1+...+x_n=constant, each x_i is a nonnegative
integer, and the order doesn't matter. (so [1,1,1,2]=[2,1,1,... |
Mysql named placeholders in python used in the IN clause
Question: I prefer to use named placeholders when hacking MySQL bound python code, but
it seems that I can't get it just right with the `IN` clause. An example:
con = MySQLdb.connect(db='test', user='test')
cur = con.cursor()
Three too si... |
flask-classy and peewee, metaclass conflict error
Question: I'm trying to get my user class to work with both BaseModel and FlaskView.
This results in the metaclass conflict error and I can't solve it.
Things I have tried to fix the problem:
This didn't work because of the _from noconflict import classmaker_. The
ex... |
Element Tree doesn't load a Google Earth-exported KML
Question: I have a problem related to a Google Earth exported KML, as it doesn't seem to
work well with Element Tree. I don't have a clue where the problem might lie,
so I will explain how I do everything.
Here is the relevant code:
kmlFile = ope... |
For each and every ssh command asks for password, Python
Question: I am trying to execute the following code, which asks me password for each and
every ssh command though I provide my password in the code. Can any one please
tell me where I am doing mistake. Thanks in advance
import signal
from subpr... |
Cannot get Cython to find the MinGW gcc compiler even after editing PATH, making a file in distutils, removing all instances of -mno-cygwin
Question: I am trying to get cython to realize I have a c compiler in MinGW 32-bit and
I've tried everything I can find on the web but it's still not working. I am
running Windows ... |
Printing one variable from a netCDF file using Python
Question: I am trying to take one variable from a netCDF file and print it. here is my
code
import netCDF4
import netCDF4_utils
from netCDF4 import Dataset
from numpy.random import uniform
import csv
B = []
rootgrp = Datas... |
Django issue with adding instances to a class
Question: The code below this compiles, but whenever I uncomment purchase_date,
po_number, or confirmed it's giving me an error. I tried python manage.py
syncdb after uncommenting those lines and it's stil giving me errors.
from django.db import models
... |
Constrain wxPython MultiSplitterWindow panes
Question: **Edit:** I'm leaving the question open as is, as it's still a good question
and the answer may be useful to others. However, I'll note that I found an
actual solution to _my_ issue by using a completely different approach with
`AuiManager`; see the [answer](http:/... |
How to extract contents of a csv file and place them in a dict file type without using csv module. [python]
Question: Here is the information in the file:
"Part no.","Description","Price"
"453","Sperving_Bearing","9900"
"1342","Panametric_Fan","23400"
"9480","Converter_Exchange","93859"
... |
How to specify that a parameter is a list of specific objects in Python docstrings
Question: I really like using docstrings in Python to specify type parameters when
projects get beyond a certain size.
I'm having trouble finding a standard to use to specify that a parameter is a
list of specific objects, e.g. in Haske... |
Python inspect.getcomments(module) doesn't return the first comment if it's a shebang
Question: When a Python file contains a shebang (`#!blabla`), the function `getcomments`
from the module `inspect` doesn't return it. What can I do to get the shebang
from a module object?
Answer: The shebang is only valid if it is ... |
Python strip. can't strip newlines but using f.read()
Question: Such a simple action, but I canoot get this to work!!!..
If I have a file that has a number of lines containing text, I want to strip
all newlines and whitespace and have a single contigous string from the
contents of the file. I've written a very simple ... |
Website remote render d3.js server side
Question: Looking for a solution to an arguably strange problem. Ok, so we are using
d3.js to plot charts and graphs. However our data sets can be very small, to
intensely massive. Right now most of what we are doing is internal and just
prototyping. However, we do show clients t... |
Generating unique usernames from an email list for creating new users in django application
Question: I am importing contacts from gmail. `c_lst` is the list that has the names and
email address in a dictionary as follows - `[{'name': u'fn1 ln1', 'emails':
[u'email1@gmail.com']}, {'name': u'fn2 ln2', 'emails':
[u'email... |
How to parse a collection of lists returned from cypher?
Question: Using python/py2neo, I run a cypher query containing
return ..., ..., collect([node1.uuid, node1.timestamp, id(node1), node2.uuid])
Both in web console and py2neo I get back a result looking like this:
[ ..., ..., [u... |
can't get make to use previously defined var's
Question: I'm using the [GnuWin32](http://gnuwin32.sourceforge.net/) project, and
created a `makefile` to manage the compiling of some code. In the command line
I run:
set PYUIC=python "E:\PortableApps\Portable Python 2.7.3.1\App\Lib\site-packages\PyQt4\uic\... |
How to run webapp2(appengine) in Heroku?
Question: Here is my project file
Procfile
web: python main.py
requirement.txt
webapp2==2.3
main.py
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write... |
Using a DOT graph as a basis for tree GUI
Question: I want to use a graph that is generated by DOT (pyDot in python) as the basis
for an interactive Tree-structured GUI in which each of the nodes in the Tree
could be widgets.
The tree will basically be a binary Morse Code tree which start at the top
node and navigate ... |
Release memory in a code using matplotlib?
Question: Well, I tried many things and I'm almost convinced that there is no way to
solve my problem. Here I go... I'm writing a simple software with tkinter and
in one part of this software I use matplotlib and basemaps to provide some
maps to the user. The problem is that i... |
using flask-sqlalchemy without the subclassed declarative base
Question: I am using Flask for my python wsgi server, and sqlalchemy for all my database
access.
I _think_ I would like to use the Flask-Sqlalchemy extension in my
application, but I do not want to use the declarative base class (db.Model),
instead, I want... |
Python, argparse: different parameters with different number of arguments
Question: I would like to write a Python script called `sync` that has three or four
modes of operation, each receiving a different number of arguments. For
example,
sync set_version <build> <version_number>
sync get_version <b... |
urllib2 fails when URL has a port number appended
Question: The code below:
import urllib2
file = urllib2.urlopen("http://foo.bar.com:82")
works just fine on my mac (OS X 10.8.4 running Python 2.7.1. It opens the URL
and I can parse the file with no problems.
When I try the EXACT same code (th... |
Printing not working in certain python functions
Question: Here is the code in trouble, should be self-explanatory with the comments:
import numpy as np
import sys
A = np.matrix([[1, 1], [2, 0]])
x0 = np.matrix([1, 0]).reshape(2, 1)
thresh = 1e-3
def inv_powerm(A, x0, thresh... |
Python Regex - How to remove text between 2 characters
Question: How can I remove anything between `")"` and `"|"`
For example,
str = "left)garbage|right"
I need the output to be `"left)|right"`
Answer:
>>> import re
>>> s = "left)garbage|right"
>>> re.sub(r'(?<=\)).*?(?=\|)', '', s... |
Python convert date string to python date and subtract
Question: I have a situation where I need to find the previous date from the
`date_entry` where the `date_entry` is string, I managed to do this:
>>> from datetime import timedelta, datetime
>>> from time import strptime, mktime
>>> date_str ... |
Animation using matplotlib with subplots and ArtistAnimation
Question: I am working on an image analysis and I want to create an animation of the
final results that includes the time-sequence of 2D data and a plot of the
time sequences at a single pixel such that the 1D plot updates as the 2D
animation progresses. Then... |
Python 3 unicode encode error
Question: I'm using glob.glob to get a list of files from a directory input. When trying
to open said files, Python fights me back with this error:
> UnicodeEncodeError: 'charmap' codec can't encode character '\xf8' in
> position 18: character maps to < undefined >
By defining a string v... |
Raw_input inside a Python process
Question: I have created a small script in python where I want to execute two function
on the same time using multiprocessing. The first function would do a
directory recursive search and the second one will display some questions to
the user. Although the .txt file is created the ques... |
Is there a way to make local titles using subplot2grid in Python
Question: I'm using suplot2grid like in the example in the matplotlib page:
ax1 = plt.subplot2grid((3,3), (0,0), colspan=3)
ax2 = plt.subplot2grid((3,3), (1,0), colspan=2)
ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2)
ax4 = p... |
Simplest method to call a function from keypress in python(3)
Question: I have a python application in which a function runs in a recursive loop and
prints updated info to the terminal with each cycle around the loop, all is
good until I try to stop this recursion.
It does not stop until the terminal window is closed ... |
Python for loop breaks text based game
Question:
#!/usr/bin/env python
import random
import time
import os
class vars:
running = 1
def win ():
print("You escaped!")
vars.running = 0
time.sleep(4)
return 0
def main ():
char_... |
Existing Tkinter Code that Takes an Input String to Another String
Question: I already posted about this, however, my purpose here is different. I believe
there should be code around that does something very similar to this. I was
hoping someone might have an idea of where to look for examples like this
(interfaces of ... |
thread safe python dictionaries?
Question: I have a function call that starts 10 threads. Before the start of these
threads , I have
from collections import defaultdict
output = defaultdict(dict)
and output is empty.
Each thread will generate data to write to the dictionary.
Something like:
... |
python timeout using os.system
Question: So, I know everyone is going to tell me to use the subprocess module, but I
can't use that for the project I am working on since Piping simply doesn't
want to work with wxpython and py2exe on my system.
So, I've been using the os.system call. I need to know how to wait for the
... |
Sending to Exchange: How to Disable Disable Lossy Conversion of HTML to RTF?
Question: I have a python script which sends a multipart email with text, html, and ics
attachments. The idea is that a modern email client will render the HTML part
and offer to add the event to the user's calendar.
Code looks like:
... |
efficiently swap a python dict's keys and values where the values contain one or more elements
Question: Suppose I have a dict:
x = { "a": ["walk", "the", "dog"], "b": ["dog", "spot"], "c":["the", "spot"] }
and want to have the new dict:
y = { "walk": ["a"], "the": ["a", "c"], "dog... |
Python Bible verse lookup
Question: I'm fairly new to python and I'm trying to learn. I'm writing a program that
will import a text file that contains the king james bible. The user would
have to enter in the bible verse for instance gen 1:1 or gen 1:1-10 and it
will either display that verse or verses upon raw data in... |
Python : How to parse the Body from a raw email , given that raw email does not have a "Body" tag or anything
Question: It seems easy to get the
From
To
Subject
etc via
import email
b = email.message_from_string(a)
bbb = b['from']
ccc = b['to']
assuming that... |
how to import module from other directory in python?
Question: This is my directory tree
Game/
a/
1.py
...
b/
2.py
In 2.py I want import function display from 1.py. First I keep both file in
same folder there is no problem.But how to import from other loc... |
python list group by first character
Question:
list1=['hello','hope','hate','hack','bit','basket','code','come','chess']
What I need is:
list2=[['hello','hope','hate','hack'],['bit','basket'],['code','come','chess']]
If the first character is the same and is the same group, then sublist ... |
work winth cassandra on centos
Question: I have a problem when I want to work with cassandra in centos Every thins is
right, I have installed Python,DJango and cassadnra on it but when I want ro
un my project I have an error in importing cqlengine to my project. Can any
one help me about it. Thanks
Answer: You need t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.