text
stringlengths
226
34.5k
Why isn't my webapp2 import / Google App Engine "Hello, World" working? Question: While I'm able to get my "Hello, World" program running on Google App Engine (GAE), it only works when I create a version that doesn't rely on the webapp2 import. Why isn't the import working? What I need to do to fix it? Version of hell...
python count number of ones in a binary image Question: What is the python module to count number of ones in a binary image ? to rephrase, I have a matrix that has only ones and zeros, it's of numpy array type and I want to know how many ones are there. Answer: You can simply use `sum`: >>> import nu...
Quit function in python program Question: I have a program that runs in Python, without the console present (which is to say, I've compiled it using py2exe). I want people to be able to quit from the main menu, or by a particular key-press in-game (say, Shift+Q). I'm running it, for now, in Windows, though I am working...
Django - consecutive dumpdata calls fail, even though work correctly when run separately Question: I've run into an issue trying to set up automatic backups on my site. The problem boils down to the following. I open the Python shell and I call the dumpdata command twice. It **works** for the first time and it returns...
basic multiprocessing with python Question: I have found information on multiprocessing and multithreading in python but I don't understand the basic concepts and all the examples that I found are more difficult than what I'm trying to do. I have X independent programs that I need to run. I want to launch the first Y ...
java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-12.txt (Access is denied) Question: I'm trying to test my servlet by running it on Tomcat. However, I get the above error (sometimes this error occurs, but earlier the servlet was running fine). A few...
Python Multithreading missing data Question: useI am working on a python script to check if the url is working. The script will write the url and response code to a log file. To speed up the check, I am using threading and queue. The script works well if the number of url's to check is small but when increasing the nu...
Python client won't reconnect to server Question: I'm sorry for my English, but I've some problems with my software and I need some help. But first of all, some code! Client side: if connessione.connect(host, port) == True: connect = True print 'connection granted' else: conn...
itertools functions not showing up in pydev quick fix Question: Using python 2.7.2 and pydev 2.5.0 and I can't seem to get eclipse to ever suggest any functions from itertools as suggestion. For example quick fixing the given the following: chain([1, 2, 3], [4, 5, 6]) Only gives logilab.common.compat as an option for...
DrawingPanel.py Drawing a rubik's cube Question: using python i'd like to draw a rubik's cube based on this picture <http://vixra.files.wordpress.com/2010/0> ... s-cube.jpg this is my current code <http://pastebin.com/MfF07ze4> but i'd like the code to have at least 5 for loops and 5 functions that will aid in the cr...
Billing aliens via POS printer and image print Question: I am trying to create a prototype to print bitmap data for a text file to my LAN enabled epson pos printer TM-T88V. While I have no problems to send text and text formatting instructions, I dont understand, what I have to do, to make my printer print the data of...
How to run an xpath over html page in python? Question: I think using lxml library in python can help, but not able to find out how to do this?? Answer: A simple starting point... import lxml.html page = lxml.html.parse('http://www.google.com').getroot() print page.xpath('//a/@href')
Why can urlopen download a Google search page but not a Google Scholar search page? Question: I'm using **Python 3.2.3's** `urllib.request` module to download Google search results, but I'm getting an odd error in that `urlopen` works with links to Google search results, but not Google Scholar. In this example, I'm sea...
python example for reading multiple protobuf messages from a stream Question: I'm working with data from spinn3r, which consists of multiple different protobuf messages serialized into a byte stream: <http://code.google.com/p/spinn3r-client/wiki/Protostream> "A protostream is a stream of protocol buffer messages, enc...
Transform filter function to Python code Question: I'm trying to understand how to transform a filter, in this case a Notch(stopband) filter, to Python but I don't know how. x(n)=-2*x(n)/(-0.9*x(n) -0.9*x(n-1)) Can anyone help me please? Thanks in advance. Answer: If you're using numpy arrays, t...
How should I get Open Graph JSON object to pass in facepy class Question: I am trying to configure Open Graph in my app such that, when ever a person click a "link" in it, the app should "post" it on his feeds/ timeline/ activity. (_`I created open graph actions for these features and successfully added meta tags in th...
error when importing ijson module python Question: I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. How...
Why is the unittest's assert methods slower than raw assertion? Question: unittest comes with many assert methods. I did a timeit test on using built-in Python `assert` and comparison operator vs built-in simple unittest assertion. #!/usr/bin/python import timeit s = """\ import unittest...
Import Local module over global python Question: I have a 2 python files. One is trying to import the second. My problem is that the second is named math.py. I can not rename it. When I attempt to call a function that is located inside math.py, I can not because I end up with the global math module. How would I import ...
No autoincrement for Integer Primary key in sqlite3 Question: In the sqlite3 [faq](http://www.sqlite.org/faq.html#q1), it is mentioned that an integer primary key being fed a null value would autoincrement. But this is not happening for me. to replicate, a table in sqlite3, `CREATE TABLE dummy( serial_num INTEGER PRIM...
How do I check lists of numeric data for a certain number using an "if" statement in Python? Question: Currently, I am attempting to retrieve numeric data from different CSV files. I then place that data in lists in Python. However, I'm struggling to get Python to determine if there is a value in each separate list of ...
Python repeating CSV file Question: I'm attempting to load numerical data from CSV files in order to loop through the calculated data of each stock(file) separately and determine if the calculated value is greater than a specific number (731 in this case). However, the method I am using seems to make Python repeat the ...
Importing from sub-folder hierarchy in python Question: i am trying to import specified modules from test_file hierarchy something like : test_case1.py test_subsuite_2 test_sub_2.1.1.py test_suite2 is it possible to do a run import on this hierarchy /project/main.py ...
Python: Put values of variables into a new dictionary Question: I am looking for a solution to put the content of 2 variables into a dictionary. One variable should serve as the key, the other as the value. Here's my code: dom = parseString(data) macro=dom.getElementsByTagName('macro') for node ...
django.core.exceptions.ImproperlyConfigured: App with label test could not be found? Question: I have a project structure as myApp/ apps/ tests/ __init__.py tests.py The `tests.py` looks as follows from django.test import Te...
Python: script to clean windows disk after % usage Question: I created a python script for cleaning old files on a windows disk. Now I want to improve that script and check if I went over a predefined disk usage and then delete files ... how I can do it? Here's my code: import os, time path = r"...
python: display elapsed time on shell Question: When I run my Python script, there is some function that takes up to a few minutes to complete, so I want to display on the shell some kind of timer that informs the user on the time elapsed. Is there any such thing already ready to use in Python? Answer: One simplisti...
Python MemoryError when storing saved lists Question: I am new to python, so I apologize if this example is trivial. I am trying to write a simple script that will pase and extract parts of two large datafiles (~40gb each) into one resulting file with a slightly altered format. I originally tried to use readlines(), b...
Python - Facebook API - Need a working example Question: Ok, so i've googled around, i've found threads here on stackoverflow and i've checked the official Facebook wiki and.. and what not.. I now hope that one of you guys sits on a Facebook API sample code for Python. This is what i've got so far and all i get is "In...
matching headers in fasta files with python Question: I have two files: the first is a fasta file with a header and sequence and the second is composed of only headers. File_1: >DF94KKQ1|265|D0M1LACXX|3|2103|4637|10742|1|N|0|TGACCA TTCCAAAGAAACATGGAAGACCCAGGACTTGGAGGCACCAGGCACCAGCACACAGGGGTA GGC...
Problems with Hangman in Pygame Question: I'm trying to find out what is wrong with the folowing code: import pygame, sys, random, linecache from pygame.locals import * #Start Pygame, define Pygame objects pygame.init() hangmanSurfaceObj = pygame.display.set_mode((640,480), 0) cl...
Connection appears accepted server-side but appears to be refused in my python script Question: I have a python script I am running to add a document to a collection for a remote mongodb database. The file is as follows: from pymongo import Connection ip = 'x.x.x.x' #edited out conn = Co...
issue converting python pandas DataFrame to R dataframe for use with rpy2 Question: I am having trouble converting a pandas DataFrame in Python to an R object, for future use in R using rpy2. The new pandas release 0.8.0 (released a few weeks ago) has a function to convert pandas DataFrames to R DataFrames. The proble...
multiprocessing.Process - Variable as function Question: I am using the code below to parallelize the processing of a numpy array. The target function in this case performs a simple linear stretch on the input data. The array is segmented and then fed to the pool in chunks. This is working quite well thanks to the nume...
Django (or other pip package) in PyPy Question: I am attempting to get django working using pypy. I have everything setup and working great under python2.7 and python3.2 is not installed. I then installed pypy and attempted to run django: Traceback (most recent call last): File "app_main.py", line ...
Is it possible to use pyGTK and Monkeyrunner in same script? Question: I started with importing GTK, and monkeyrunner: from com.android.monkeyrunner import MonkeyRunner import gtk ... when I run this with monkeyrunner in the SDK tools, it says `ImportError: No module named gtk`. When I run ...
Runtime import with with multiple subdirectories in python Question: what is the best way to perform this type of import in python file to be imported which is available in location one/ne_one/one_two/" fielname : two.py def foo(): print "venkatttt!" main file : main.py s =...
Layout of python code Question: I'm trying to learn the best way to arrange/define code. Taking the below as an example, I have to write the tkMessageBox command twice. I did try to create a def within getText() and refer to that, but it didn't work. Questions therefore please 1) How could I arrange the code such tha...
Django nonrel development server doesn't import amazon.api Question: I have a weird problem with Django nonrel's development server: I have installed [Amazon Simple Product API](https://github.com/yoavaviram/python-amazon-simple-product-api/ "Amazon Simple Product API") , and it works fine in the shell, I can import i...
Python - SQL Server call not using a transaction Question: I have a simple Python script where I send in a call to a SQL Server 2008 stored procedure which in turn uses bcp through xp_cmdshell. When I call the SP through management console, it works just fine. When I call it from the python script, it hangs up as the e...
askdirectory() changes focus to different window Question: I am using Tkinter to build two windows. One the main one, pressing a button leads to the creation of the second window. This second window does not get focus immediately when it created. That I am able to fix by calling .focus_force(). However, when I call th...
Reproduce the Unix cat command in Python Question: I am currently reproducing the following Unix command: cat command.info fort.13 > command.fort.13 in Python with the following: with open('command.fort.13', 'w') as outFile: with open('fort.13', 'r') as fort13, open('command.in...
Python/Django mime multipart email using boundary Question: In Django(with python), how can I build an email that looks as follows: What I need is an e-mail that starts with: Content-Type: multipart/alternative; boundary="=_5f8686714d769f9476ce778798b84ff4" The boundary is the place to put pla...
Retrieving outlook Contacts via python Question: I am Trying to get Contacts out of `Outlook` using `Python`. The code is : import win32com.client import pywintypes o = win32com.client.Dispatch("Outlook.Application") ns = o.GetNamespace("MAPI") profile = ns.Folders.Item("Outlook") ...
How to Pass windows full title name with space using Pywinauto in python Question: I wanted to automate Adobe Reader menus, from pywinauto import application app = application.Application() app.start_(r"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe") so after how to get comple...
R fitdistr for Beta distribution: which starting parameters? Question: I need to fit my data into a Beta distribution and retrieve the alpha parameter. I'm trying to use R from python (rpy2) and my code looks like: from rpy2 import * from rpy2.robjects.packages import importr MASS = importr('MASS...
Python TCPServer Question: I have a simple question. When I create a python TCPServer for example using the example code : import sys, SocketServer, os from multiprocessing import Pool, Queue class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): ...
Load and show an image from the web in Python with Gtk 3? Question: I'm writing an app on Ubuntu 12.04 with Python and GTK 3. The problem I have is that I can't figure out how I should do to show a Gtk.Image in my app with an image file from the web. This is as far as I have come: from gi.repository imp...
Correct way to pause Python program Question: I've been using the input function as a way to pause my scripts print("something") wait = input("PRESS ENTER TO CONTINUE.") print("something") is there a formal way to do this? Answer: Seems fine to me (or `raw_input()` in Python 2.X). Alterna...
Efficient method for getting elementwise types in Python/Pandas Question: Following up on [a previous question](http://stackoverflow.com/questions/11548005/numpy-or-pandas-keeping- array-type-as-integer-while-having-a-nan-value), is there a preferred efficient manner to get the type of each object within a column? This...
CryptoJS and Pycrypto working together Question: I'm encrypting a string in a web application using CryptoJS (v 2.3), and I need to decrypt it on the server in Python, so I'm using PyCrypto. I feel like I'm missing something because I can't can it working. Here's the JS: Crypto.AES.encrypt('123456789012...
Integrating in Python using Sympy Question: I am currently using `Sympy` to help me perform mathematical calculations. Right now, I am trying to perform a numerical integration, but keep getting an error any time I run the script. Here is the script: from sympy import * cst = { 'qe':1.60217646*10**-1...
Can I bind multiple servers to the same TCP port? Question: I would expect having multiple servers on the same port would cause problems. In fact I want it to throw an exception when I try to start two servers on the same port. The problem is, it seems more than happy to start multiple servers on the same port. I can h...
Which module should I import to use a PyHKEY? Question: I'm attempting to win32api.RegLoadKey part of the pywin32 extension, however, I am assuming I need to create a PyHKEY first. But I don't know which module PyHKEY is in. The documentation is equally useless. <http://docs.activestate.com/activepython/2.4/pywin32/PyH...
VPython Install Issues Question: I'm trying to import the visual module for 64-bit python. Unfortunately, I keep getting the following error: > ImportError: numpy.core.multiarray failed to import > > Traceback (most recent call last): > > File "C:\python\color_space.py", line 2, in > > > from visual import ...
Latitude and Longitude to Address Question: I have about 8000 + Latitudes and Longitudes. I need to extract(reverse code), them to location, possibly city. Initially I checked with Google Maps, but according to their terms we should not hit their services with our scripts. Even the OpenStreetMaps doesnt allow us to h...
matplotlib - control capstyle of line collection/large number of lines Question: Similarly to a [previous question](http://stackoverflow.com/questions/11312579/networkx-draw-networkx- edges-capstyle) of mine, I'd like to control the capstyle of lines being drawn using matplotlib. However, I have an extremely large numb...
TypeError with PAMIE Question: I am getting a TypeError with a very simple script on PAMIE, and I'm not sure what I can do. I had found an answer suggesting that the library, `pywin32` might not have set a `self` argument for this particular method (`getElementsByTagName`) but I don't know for sure, as I don't know whe...
Best Method to Find Multiple String Occurrences in Python Question: I need to be pointed in the right direction for this problem I'm working on: Let's say I'm reading output from a C program as follows: while True: ln = p.stdout.readline() if '' == ln: break #do stuff...
Copy a file line by line in python Question: I am writing a python program to copy a file line by line into a new file. The code I have is below in which I am using a loop to copy the file line by line. However since the number of lines in the file may change, is there a way to copy a file line by line in python witho...
Ubuntu pass information to a text file during process execution Question: My issue is that I have a function call it function1 which runs indefinitely. The function itself echo's "hello" every 1 second. Using the command: function1 >> temp.txt Every 1 second if I am to view the file temp.txt I shou...
SSL Connection Using .pem Certificate With Python Question: I'm trying to establish successful communication over an HTTPS connection using authentication. I'm using Python 2.7 w/ Django 1.4 on Ubuntu 12.04. The API documentation I'm following has specific requirements for authentication. Including the `Authentication...
Django Installation Error : Question: Trying to create the first project. First got the below error when I ran, django-admin.py startproject mysite then I tried, django-admin.py Also symlinked the path and its in the path. But I still get the error. . . . File "/Users/Satha/django-trunk/django/bin/django-admin.p...
python subprocess as normal user Question: I have a script that needs to be run as a super user: $ sudo ./python-script.py Within this script, I do some other things that _do not_ require super user privileges. $ os.mkdir('somefolder') What is the best/most efficient way of cre...
Is there a python json library can convert json to model objects, similar to google-gson? Question: The standard python json module only can convert json string to dict structures. But I prefer to convert json to a model object strutures with their "parent- child" relationship. I use google-gson in Android apps but d...
Python - how to create a random string 8 bytes long? Question: > **Possible Duplicate:** > [python random string generation with upper case letters and > digits](http://stackoverflow.com/questions/2257441/python-random-string- > generation-with-upper-case-letters-and-digits) I need to create a random string that is...
How can I further shorten this Python script which copies the contents of one file to another file? Question: I'm reading Zed Shaw's "Learn Python The Hard Way". I'm up to exercise 17 ( <http://learnpythonthehardway.org/book/ex17.html> ) and hit the wall on extra credit #'s 2 & 3\. Zed wants me to shorten the script by...
Programmatically login to OKC Question: I'm trying to programatically login to OKCupid ([www.okcupid.com/login](http://www.okcupid.com/login))in order to fetch scrape some user data. I've tried to put together a python script to do this, but seem to be doing something wrong. The behavior I'd like from this sample scri...
How can I display an image in Python 3 using tkinter/ttk? Question: The nub of the matter is, what am I doing wrong in the following code snippet? from tkinter import * from tkinter.ttk import * root = Tk() myButton = Button(root) myImage = PhotoImage(myButto...
Importing matplotlib on Ubuntu Question: So I downloaded and installed matplotlib. The weird things is that I can run the examples fine when they were placed in home/user/Desktop but when I moved them to home/user/Documents, they stopped working and I get the below message. Is there something special about the Document...
Youtube in Webkit/Python/GTK app Question: I'm trying to do a python(2.7)/GTK+ app, and I have a window, containing a WebKit WebView. from gi.repository import Gtk, WebKit class MainWindow: def __init__( self ): self.builder = Gtk.Builder() self.builder.add_from_f...
How to install and run pandas python library in Eclipse Juno? Question: I am using pydev plugin in Eclipse Juno for my python programming in windows 7 and i am using python 3.2, it works fine while running python application which using standard python packages. For my one of my project i have to use pandas library, fo...
Check if a directory exists in a zip file with Python Question: Initially I was thinking of using `os.path.isdir` but I don't think this works for zip files. Is there a way to peek into the zip file and verify that this directory exists? I would like to prevent using `unzip -l "$@"` as much as possible, but if that's t...
Python SciPy FFT function - Input? Question: I am currently writing some code which is supposed to perform FFT on a set of data. I have a python list of points and I can easily create a time list. When I run fft(datalist), I get the 'TypeError: 'numpy.ndarray' object is not callable' error. I think (but please correct ...
How to determine whether a year is a leap year in Python? Question: I am trying to make a simple calculator to determine whether or not a certain year is a leap year. By definition, a leap year is divisible by four, but not by one hundred, unless it is divisible by four hundred. Here is my code: def le...
Python:Importing moduel Attribute Error,LPTHW ex47: Question: I'm doing ex47 from Learn python the hard way[This is the exercise](http://learnpythonthehardway.org/book/ex47.html) And this is my code: from nose.tools import* from ex47.game import Room def test_room(): gold = Room...
Python MMTK "There is no program associated with ..pdb files, please install a suitable viewer" Question: I'm new to programming and computer world. I'm trying to study biomolecular simulations with MMTK. I run it in Windows 7 and I have already installed this software: * python-2.5.4 * numpy-1.6.2-win32-superpac...
Use entire scope as input in plugin in Sublime Text 2 Question: One of the nice things about Textmate was the ability to pipe the contents of an entire scope into a command, like so: ![Textmate screenshot](http://i.stack.imgur.com/Yiekh.png) You could then specify the scope to be used, such as `meta.class.python` or ...
Using Flask, trying to get AJAX to update a span after updating mongo record, but it's opening a new page Question: Feel like I am stumbling over something fairly simple here. I am not understanding something about AJAX and Flask. I have a project wherein I display mongodb records in the browser, which has been worki...
Python: convert string to byte array Question: Say that I have a 4 character string, and I want to convert this string into a byte array where each character in the string is translated into its hex equivalent. e.g. str = "ABCD" I'm trying to get my output to be array('B', [41, 42, 4...
Problems using etree in Python scraper Question: I'm a newbie in Python looking to build a screen scraper in Scraperwiki but I'm struggling with an error I can't work out how to fix. Essentially, I want to parse an xml file but can't work out how to have my gp_indicators_scrape function access the getroot() method. Ca...
Python Running an Excel Macro Question: I am trying to use python to run an excel macro and then close excel. I have the following: import win32com.client import os xl = win32com.client.DispatchEx("Excel.Application") wb = xl.workbooks.open("X:\Location\Location2\File1.xlsm") xl...
List integration as argument (beginner) Question: I am writing a script in python, but I am a beginner (started yesterday). Basically, I just create chunks that I fill with ~10 pictures, align them, build the model, and build the texture. Now I have my chunks and I want to align them... From the [manual](http://downl...
Is it possible to draw graphs on a given image using NetworkX? Question: Is it possible to draw graphs on a given image (instead of on an empty figure) by using the python package NetworkX? Answer: Perhaps you can try this but it requires matplotlib: import matplotlib.pyplot as plt import matplotli...
Python wrapper script to let a program be executed remotely with no blocking Question: I am looking for a wrapper script to run a program which is called remotely by a SSH command which terminates without waiting for the result of the program. Here is my code: #!/usr/bin/python import sys i...
Python: change CWD of script bundled with py2app Question: My script works fine when ran with `python`, but after I build it with `py2app`, files and folders are created in `.app/Contents/Resources`. I use `os.getcwd()` to find out where the script is located. How can I fix this and make sure my files are created in t...
__init__() takes at least 2 arguments (1 given) When Migrating using South with Custom Fields Question: **i am new to south and i followed their documentation and after initializing south migrations, after running** manage.py migrate appname **for the following custom models Models i added introspe...
Python does not detect .pyc files Question: I am using Python 3.2 (both for building and executing), and here is my question. I intend to ship my python application with the following setup: There is a main script (say, `Main.py`), that is using a compiled module, say `Module1.pyc`). To be precise, the directory stru...
Best lightweight, responsive GUI framework Linux Question: I've bought a Raspberry Pi, featuring a 300 Mhz CPU, but it does has a pretty good GPU. It can even run XBMC. I want to program a GUI for it, which needs to be responsive and good-looking, while taking optimal use of the hardware available (which isn't too good...
Getting docstrings from Python package __init__ - based imports Question: I have several modules that are within a Python package: # my_package contents __init__.py module1.py module2.py Within my `__init__.py`, I'm importing these modules so that they will be accessible once the packag...
Running wexpect on windows Question: I have installed wexpect on windows7, now when i am trying to run any command, i am getting below error. I am using MKS toolkit, so ls is a valid command. >>> import pexpect >>> pexpect.run('ls ') Traceback (most recent call last): File "<stdin>", line 1, ...
Issue building cx_Oracle - libclntsh.so.11.1 => not found Question: I'm trying to build cx_Oracle for a Python 2.7.2 and Oracle 11g installation but the built cx_Oracle.so cannot find libclntsh.so.11.1 so importing cx_Oracle in Python fails. /mypath/cx_Oracle-5.1.1/build/lib.linux-x86_64-2.7-11g]$ ldd cx...
python module resides in a repository whose name contains dash characters Question: I know name of the module should not have a dash. Here is my repository structure my-repo-name/ src/ tests/ __init__.py tests.py fab/ __init__.py ...
How can I step to use the python debugger to break at every function call? Question: I want to closely monitor the chain of function calls which are called from a certain function. import pdb; pdb.set_trace() res = api.InsertVideoEntry(video_entry, video) I'm looking for a way to easily see tha...
Python: Read from and write to a CSV file Question: I am trying to read data from a CSV file (A), extract data, and write that to a different CSV file (B). In the new file B, I want to have two columns. Column 1 to list names of column 1 in file A and column 2 to list the count of column 1 in file A. So for example, if...
Eclipse unresolved external with geopy Question: import csv from geopy import geocoders import time g = geocoders.Google() spamReader = csv.reader(open('locations.csv', 'rb'), delimiter='\t', quotechar='|') f = open("output.txt",'w') for row in spamReader: a = ', '.j...
Is there a way to simulate python random.shuffle of a queue using a pseudorandom sequence or hash function? Question: I'm building an application based around a task queue: it serves a series of tasks to multiple, asynchronously connected clients. The twist is that the **tasks must be served in a random order**. My pr...
Why doesn't PIL load locally while running Google App Engine Python 2.7 Mac OSX? Question: I am using Google App engine on Mac OSX 10.7.4. When I load PIL from the commandline, everything works fine. However, when I load it from the GAE local environment, i.e.: > import Image Gives me the error: > ImportError: No mo...
Iteration of calendar.month_name can't be parsed by strptime() Question: Here's something that seems a little silly: `datetime.strptime()` is happy to accept an iterated list of month names when I just create a list by hand (`months = ['January','February']`) but not when I iterate over a list of months created by `cal...
Subtract values in one list from corresponding values in another list - Python Question: I have two lists: A = [2, 4, 6, 8, 10] B = [1, 3, 5, 7, 9] How do I subtract each value in one list from the corresponding value in the other list and create a list such that: C = [1, 1, 1, 1...