text
stringlengths
226
34.5k
How to retrieve nested map values Question: I want to scan AWS DynamoDB table and then pull only a certain value. Here is my code: package main import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/s...
Grouping up elements from a list in Python 2.7 Question: Ok, I got a huge text. I extract matches with regex (omitted here because it doesn't matter and I'm bad at this so you don't see how ugly my regex is :) ) and count them. Then, for readability, I split the elements and print them in the fashion I need: ...
Python Simon Game: I Got Stuck Finishing the Sequence Question: I'm finally finishing my Simon Game, but I have some doubts about how to complete the sequence. Edit: As you asked I have edited my post. Here I will post my code as it was before this post. So here are my actual problems. 1) I don't know how to add one ...
ValueError: script argument must be unicode. - Python3.5, SQLite3 Question: I'm writing following python script: import sqlite3 import sys if len(sys.argv) < 2: print("Error: You must supply at least SQL script.") print("Usage: %s table.db ./sql-dump.sql" % (sys.argv[0])) ...
Python: Properly formatting JSON parameters into a proper http request with markit on demand api Question: I am having trouble formatting my request properly in order to use the markitondemand InteractiveChart API. How can I properly do this? reference: <http://dev.markitondemand.com/MODApis/> Here is an example of a...
UnicodeEncodeError Only When Script is Run as a Subprocess Question: I'm running my main script in Python 3.5 using the Spyder IDE, and I want to import functions from a script that happens to only work in Python 3.4. So I was recommended to run this second script as a subprocess like so: import subproce...
File upload Selenium Web driver python in linux machine calling a remote machine Question: Hi I have scenario that needs to upload a file in a webpage. Actually I know that `selenium` will not support file upload scenario. But this can be done in python with external libraries such as `AUTOIT`, `PYWINAUTO`. But the cha...
Raspberry Pi getting data from MultiWii Question: I have a Raspberry Pi 3B and a CRIUS All in One Pro (v2.0) MultiWii flight controller. I'm using the MultiWii 2.4 version and the latest NOOBS. I was able to set up both fine, and now I am trying to get the Raspberry Pi to communicate with the MultiWii through a USB/Mic...
Python - Unable to detect face and eye? Question: I am trying to create a face and eye detection using OpenCV library. This is the code I been working with. It's running smoothly with no errors but the only problem is not showing any results no faces and eyes are found with this code import cv2 impor...
ImportError: No module named 'theano' Question: I have installed (/library/python/2.7/site-packages) theano on my mac and still get this error. **My code is** import theano theano.test() **and the error** Traceback (most recent call last): File "/Users/mac/Downloads/n.py",...
TypeError: 'module' object is not callable in Spacy Python Question: I want to print `Parse Tree` using `Spacy`. But the code below is giving the error > en_nlp = spacy.language('English') TypeError: 'module' object is not > callable The error is on this `en_nlp = spacy.loads('en')` line. I tried to shake off as `en_...
Bokeh plots not showing in nbviewer Question: I am working on some visualizations using Bokeh in a Jupyter (ipython) notebook. Though the plots run well within my notebook, it is important for me to make them accessible for users not running the code. I was counting on nbviewer for this, but am having trouble. Using a...
is "from flask import request" identical to "import requests"? Question: In other words, is the flask request class identical to the requests library? I consulted: <http://flask.pocoo.org/docs/0.11/api/> <http://docs.python-requests.org/en/master/> but cannot tell for sure. I see code examples where people seem to ...
Update a label in tkinter from a button press Question: My question is regarding GUI programming in python by using tkinter. I believe this is Python 3x. My question: While we're executing a program to run the GUI, can a button update a label? More specifically, is there a way to change the labels displayed text after...
How can this tensorflow model converge on a CPU but not on a GPU? Question: We ran into the strange problem that our relatively simple model converges on the CPU, but not on the server with GPU. No modifications to the code are done whatsoever between the two runs. Nor does the code contain any explicit conditional sta...
how to process an upload file in Flask? Question: I have a simple Flask app and I would like for it to process an uploaded excel file and display it's data in the webpage. So far I got a page to upload the excel file. main.py from flask import Flask, render_template, send_file, request from flask_up...
compare two results (of many) from api data with django/python Question: I'm learning django/python/css/etc... and while doing this, I've decided to build an app for my website that can pull simple movie data from TMDb. What I'm having trouble with is figuring out a way to add a way for the **user to select two differe...
How to download japanese history stock prices automatically from google finance in python Question: I use python to analyze Japanese stock prices. I want to get Japanese historical stock prices to get from google finance. I also refer to googlefinance0.7 ( <https://pypi.python.org/pypi/googlefinance> ) and pandas, but ...
numpy ndarray with more that 32 dimensions Question: When I try to create an numpy array with more than 32 dimensions I get an error: import numpy as np np.ndarray([1] * 33) --------------------------------------------------------------------------- ValueError ...
python3 global name 'SOL_SOCKET is not defined Question: when I use `gevent`, I can not use `requests`, is my useage wrong? from gevent import monkey; monkey.patch_all() import gevent, requests requests.get('https://haofly.net') it raise the error: Traceback (most recent call...
Extract hyper-cubical blocks from a numpy array with unknown number of dimensions Question: I have a bit of python code which currently is hard-wired with two-dimensional arrays as follows: import numpy as np data = np.random.rand(5, 5) width = 3 for y in range(0, data.shape[1] - W + 1):...
Discovering data type of incoming socket data in python Question: There are couple of devices which are sending socket data over _TCP/IP_ to socket server. Some of the devices are sending data as _Binary encoded Hexadecimal string_ , others are _ASCII string_. Eg.; If device sending data in _ASCII string_ type, scrip...
Running python on server, executing commands from computer Question: I made a login system with python. It works perfectly, but i want to run script on server or web. For example: Steam. Steam wants username and password to log in. So i wanted to do the same for my script. How can i do that? My Code: im...
Convert a string to JSON Question: I would like to convert this string to a JSON dict: {u'Processes': [[u'root', u'3606', u'0.0', u'0.2', u'76768', u'16664', u'?', u'Ss', u'20:40', u'0:01', u'/usr/local/bin/python2 /usr/local/bin/gunicorn app:app -b 0.0.0.0:80 --log-file - --access-logfile - --workers 4 ...
imports python3 in another folder Question: When I run launch.py it fails and when I run main.py directly it works. launch.py just imports and runs main.py. Why? ├── dir │   ├── bla.py │   ├── __init__.py │   └── main.py ├── __init__.py └── launch.py launch.py --------- ...
embedding resources in python scripts Question: I'd like to figure out how to embed binary content in a python script. For instance, I don't want to have any external files around (images, sound, ... ), I want all this content living inside of my python scripts. Little example to clarify, let's say I got this small sn...
Shut down Flask SocketIO Server Question: For circumstances outside of my control, I need to use the Flask server to serve basic html files, the Flask SocketIO wrapper to provide a web socket interface between any clients and the server. The `async_mode` has to be `threading` instead of `gevent` or `eventlet`, I unders...
assert vs == for testing code in Python? Question: What is the need for importing unittest and running assertTrue (for example) while testing a python function instead of writing a usual python function with == True check for testing? What is the new thing about unittesting, as even the test cases have to be written by...
My numpy is latest but tensroflow says it's old one Question: $pip list numpy(1.11.1) My numpy is latest and I am sure it could be used in python environment. >>> import numpy >>> print numpy.__version__ 1.11.1 however I use tensorflow $ tensorboard --logd...
python import * or a list from other level Question: I'm trying to import a few classes from a module in another level. I can type all the classes, but I' trying to do it dynamically if I do: from ..previous_level.module import * raise: SyntaxError: import * only allowed at module level th...
get picture from dynamic content python Question: I'm trying to get the href of the picture from an url without using selenium def(): try: page = urllib2.urlopen('') except httplib.IncompleteRead, e: page = e.partial response = BeautifulS...
Russian character decoding in python Question: This question only for python: I have a city name in a string in Russian language and which is in Unicode form like, > `\u041C\u043E\u0441\u043A\u0432\u0430` means > `Москва` How to get original text instead of unicode characters? **Note:** Do not use any import modu...
I'm not sure what a certain code line does Question: I was trying to have a program using Python to create a "pyramid" based on a number, n, out of o's and came up with this: ( I would print nn, that would be the lines.) import time n = 0 while True: n += 2 #just another way to show ...
Selenium Webdriver Python: I can't seem to locate all the text in a label tag Question: <label class="control-label"> Rental Charge: <span class="required" ng-show="vm.rentalInfo.reason">* (Min of $30.00)</span> </label> I used driver.find_element_by_xpath("//label[@ class = ...
Run multiple servers in python at same time (Threading) Question: I have **2 servers** in python, **I want to mix them up in one single .py and run together** : Server.py: import logging, time, os, sys from yowsup.layers import YowLayerEvent, YowParallelLayer from yowsup.layers.auth import AuthE...
Selenium webdriver unable to restart after unexpected exit Question: I haven't been able to start up an instance of python's selenium webdriver after my last use a few days ago. According to the error messages, it unexpectedly quit last time I was using it, and now, after restarting my macbook, uninstalling and reinsta...
django: link to detail page from list of returned results Question: I'm creating a page that returns a list of movies with basic details after a user search. **After the search, I'd like the user to be able to click on a movie, and get more details about it.** here's a link to the site: (be gentle, I only started lea...
I am using beautifulsoup in python 3. But "html.parser" not give me the all code of website Question: My code is import urllib import urllib.request from bs4 import BeautifulSoup fed = "https://www.fedex.com/apps/fedextrack/?action=track&tracknumbers=870915037012296&cntry_code=us&wsc...
Jenkins git triggered build not blocking Question: I am running a build on commit to `origin/master` on my jenkins server that is deploying resources to Amazon AWS. I am using the Execute Shell section to run a python script that handles all unit testing/linting/validation/deployment and everything blocks fine until it...
Obtain csv-like parse AND line length byte count? Question: I'm familiar with the `csv` Python module, and believe it's necessary in my case, as I have some fields that contain the delimiter (`|` rather than `,`, but that's irrelevant) within quotes. However, I am also looking for the byte-count length of each origina...
How to use yaml.load_all with fileinput.input? Question: Without resorting to `''.join`, is there a Pythonic way to use PyYAML's `yaml.load_all` with `fileinput.input()` for easy streaming of multiple documents from multiple sources? I'm looking for something like the following (non-working example): # ...
matplotlib multiple values under cursor Question: This question is very similar to those answered here, [matplotlib values under cursor](http://stackoverflow.com/questions/14754931/matplotlib-values-under- cursor) [In a matplotlib figure window (with imshow), how can I remove, hide, or redefine the displayed position...
python logging module AttributeError: 'str' object has no attribute 'write' Question: I am using tornado,and in its app,I import logging just want to log some info about server. I put this: logging.config.dictConfig(web_LOGGING) right before: tornado.options.parse_command_line() ...
wxpython phoenix: How to get float values from wx grid cells and perform mathematical operations? Question: I am trying to build a invoice with wx grid, I would like to add the values in quantity column and the values in price column and display it in the row total. import wx import wx.grid as gridli...
Class and external method call Question: I am going through a data structures course and I am not understanding how a Class can call a method that's in another Class. The code below has 2 classes: `Printer` and `Task`. Notice that class `Printer` has a method called `startNext`, and this has a variable `self.timeRe...
tweepy.error.TweepError: [{u'message': u'Text parameter is missing.', u'code': 38}] Question: I am using `tweepy` twitter api for python, while using it i got some error, I am not able to use `send_direct_message(user/screen_name/user_id, text)` this method Here is my code:- import tweepy consumer_k...
Get "TypeError: cannot create mph' When Using sympy.nsolve() Question: I am attempting to determine the time, angle and speed that something would have to travel to intersect with a moving ellipse. (I actually want these conditions for the minimum time). Right now I was trying to use Sympy to help with this adventure. ...
Python PYQT Tabs outside app window [why] Question: Tabs added before app.exec_() is called look and act as any other tabs u met, though if adding another after the app.exec_() call makes the new tab 'detach' from the main app window. Pic below :) Why? How can I make it move inside the window? import th...
Read a complete data file and round numbers to 2 decimal places and save it with the same format Question: I am trying to learn python and I have the intention to make the a very big data file smaller and later do some statistical Analysis with R. I need to read the data file (see below): SCALAR ND ...
Python - Removing vertical bar lines from histogram Question: I'm wanting to remove the vertical bar outlines from my histogram plot, but preserving the "etching" of the histogram, if that makes since. import matplotlib.pyplot as plt import numpy as np bins = 35 fig = plt.figure(f...
when i made a 3 handshake with ubuntu in VMware return package R Question: #!/usr/bin/python from scapy.all import * def findWeb(): a = sr1(IP(dst="8.8.8.8")/UDP()/DNS(qd=DNSQR(qname="www.google.com")),verbose=0) return a[DNSRR].rdata def sendPacket(dst,src): ip = IP(d...
Complete Algebraic Equations Question: Im trying to build an app that graphs an equation based on user input. The equation would be in slope intercept form: `y = mx + b`, for `m` as slope and `b` as `y intercept`. However, this isn't working for me in python! I tried this: >>> x = 3 >>> 1/2x a...
Python bokeh apply hovertools only on model not on figure Question: I want to have a scatter plot and a (base)line on the same figure. And I want to use `HoverTool` only on the circles of scatter but not on the line. Is it possible? With the code below I get tooltips with `index: 0` and `(x, y): (???, ???)` when I hov...
How to see the plot made in python using pandas and matplotlib Question: I am following the tutorial <http://ahmedbesbes.com/how-to-score-08134-in- titanic-kaggle-challenge.html> and following is my code from IPython.core.display import HTML HTML(""" <style> .output_png { display: tab...
AttributeError: type object has no attribute "id" PYTHON Question: So I was trying to make a basic python pong game when this error came up: It seems to say that AttributeError: type object has no attribute "id" which I have no idea what it means. C:\Users\****\AppData\Local\Programs\Python\Python35-32\p...
Edited - Python plot persistence windows Question: Each time I launch my program, my plots are erased after each execution. I would like the following situation: 1. Launch program 1 and plot in figure 1 2. Stop the execution of program 1 3. Lauch program 2 and plot in figure 1 4. Retrieve a pdf file where the...
Iterating across multiple columns in Pandas DF and slicing dynamically Question: **TLDR:** How to iterate across all options of multiple columns in a pandas dataframe without specifying the columns or their values explicitly? **Long Version:** I have a pandas dataframe that looks like this, only it has a lot more feat...
Adding exception to "AttributeError" python Question: So, I have some tweets with some special characters and shapes. I am trying to find a word in those tweets by converting them to lower case. The function throws an "AttributeError" when it encounters those special characters and hence, I want to change my function i...
<urlopen error (-1, 'SSL exception: Differences between the SSL socket behaviour of cpython vs. jython are explained on the wiki Question: I'm using the following code. import urllib2 #Setting proxy myProxy = {'https':'https://proxy.example.com:8080'} proxy = urllib2.ProxyHandler(myProxy...
Extracting hand writing text out in shape with OpenCV Question: I am very new to OpenCV Python and I really need some help here. So what I am trying to do here is to extract out these words in the image below. [![hand drawn image](http://i.stack.imgur.com/XsSOP.jpg)](http://i.stack.imgur.com/XsSOP.jpg) The words and...
Reshaping OpenCV Image (numpy) Dimensions Question: I need to convert an image in a numpy array loaded via cv2 into the correct format for the deep learning library mxnet for its convolutional layers. My current images are shaped as follows: (256, 256, 3), or (height, width, channels). From what I've been told, this ...
How to fetch JSON data from API, format / encode / write to a file? Question: I need to fetch some data from a weather API, extract certain info and send it to std. output (in my case this is the console/terminal; I am playing around with python API scripting and do not yet have a web site/app do show fetched data). *...
Python won't print expression Question: So, I'm kind of new to programming and have been trying Python. I'm doing a really simple program that converts usd to euroes. This is the text of the problem that I'm trying to solve > You are going to travel to France. You will need to convert dollars to euros > (the currency...
Can't login to a specific ASP.NET website using python requests Question: So I've been trying for the last 6 hours to make this work, but I couldn't and endless searches didn't help, So I guess I'm either doing something very fundamental wrong, or it's just a trivial bug which happens to match my logic so I need extra ...
Cleaner method for finding the shortest distance between points in a python list? Question: I have a list of tuples and an individual point in python e.g. [(1,2) , (2,5), (6,7), (9,3)] and (2,1) , and I want to figure out the fastest path possible created by all combinations of the individual point to the list of point...
Prepare my bigdata with Spark via Python Question: My 100m in size, quantized data: (1424411938', [3885, 7898]) (3333333333', [3885, 7898]) Desired result: (3885, [3333333333, 1424411938]) (7898, [3333333333, 1424411938]) So what I want, is to transform the data so that...
Openpyxl. Max_columns giving error Question: I'm using openpyxl-2.4.0-b1 and Python version 34. Following is my code: from openpyxl import load_workbook from openpyxl import Workbook filename= str(input('Please enter the filename name, with the entire path and extension: ')) wb = load_workbook(fil...
Showing results python command to the web cgi Question: I have a python script and it runs well if executed in a terminal or command line , but after I try even internal server error occurred . how to enhance the script to be run on the web. HTML <html><body> <form enctype="multipart/form-data" acti...
Is there a tool to check what names I have used from a "wildly" imported module? Question: I've been using python to do computations for my research. In an effort to clean up my terrible code, I've been reading [Code Like a Pythonista: Idiomatic Python](http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.h...
Python sorting nested dictionary list Question: I am trying to sort a nested dictionary in Python. Right now I have a dictionary of dictionaries. I was able to sort the outer keys using sorted on the list before I started building the dictionary, but I am unable to get the inner keys sorted at this time. I've been tryi...
Create gantt chart with hlines? Question: I've tried for several hours to make this work. I tried using 'python-gantt' package, without luck. I also tried plotly (which was beautiful, but I can't host my sensitive data on their site, so that won't work). My starting point is code from here: [How to plot stacked event ...
How to play music using pygame (Python) Question: I am trying to play an .mp3 file using pygame. Here is my code: import pygame pygame.init() pygame.mixer.init() pygame.mixer.music.load('MSM.mp3') pygame.mixer.music.play(0) pygame.event.wait() This however does no...
scipy.interpolate leads to ImportError Question: my setup is import cartopy.crs as ccrs import matplotlib.pyplot as plt I have scipy `0.17` and cartopy '0.14.2'. All I'm trying to do is plt.axes(projection=ccrs.PlateCarree()) and it leads to this: Traceback ...
Matplotlib: Every tick in different color Question: I'm trying to create a scatter-plot with matplotlib (python 3.5) in which every tick on the x-axes has a different color. How is this possible? For example let's say the x-ticks are 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'. Now I want 'Mo' to be green, 'Tu' to be blu...
i want to scrape data using python script Question: I have written python script to scrape data from <http://www.cricbuzz.com/cricket-stats/icc-rankings/batsmen-rankings> It is a list of 100 players and I successfully scraped this data. The problem is, when i run script instead of scraping data just one time it scraped...
In 'IDA PRO', let 'IDAPython' import default module at startup Question: We know 'IDAPython' loads several modules by default at startup, such as idaapi, idautils.... I wrote a module to let python print all numbers as hex format in the command window, which I wish can be imported each time when python loads those defa...
Sending gzip compressed data through TCP socket in Python Question: I'm creating an HTTP server in Python without any of the HTTP libraries for learning purposes. Right now it can serve static files fine. The way I serve the file is through this piece of code: with open(self.filename, 'rb') as f: ...
Convert strings of bytes to floats in Python Question: I'm using Pandas to handle my data. The first step of my script is to convert a column of strings of bytes to a list of floats. My script is working but its taking too long. Any suggestions on how to speed it up?? def byte_to_hex(byte_str): a...
Adding an extra hidden layer using Google's TensorFlow Question: I am trying to create a multi-label classifier using TensorFlow. Though I'm having trouble adding and connecting hidden layers. I was following this tutorial: <http://jrmeyer.github.io/tutorial/2016/02/01/TensorFlow-Tutorial.html> The data I'm using is ...
Trouble installing cryptography with pip3 (Ubuntu 16.04 LTS) Question: i'm currently having trouble installing cryptography with pip3. I tried all the other solutions but non of them worked. Here is the output from "sudo -H pip install cryptography": Collecting cryptography Using cached cryptograp...
calculate catalan numbers up to a billion Question: I'm new to python (and programming in general), I was asked in my class to calculate Catalan numbers up to a billion but the program I wrote for it is not working as intended. from numpy import division C=1 n=0 while C<=1000...
Reassigning a return variable to a function in Python Question: I am trying to figure out why I am getting a "SyntaxError: invalid syntax " the variable title is highlighted red from urllib.request import urlopen from urllib.error import HTTPError from urllib.error import URLError from bs4 im...
Extracting text from multiple powerpoint files using python Question: I am trying to find a way to look in a folder and search the contents of all of the powerpoint documents within that folder for specific strings, preferably using Python. When those strings are found, I want to report out the text after that string a...
how to parse key value pair request from url using python requests in flask Question: I have spent about a week on this issue and although I have made considerable progress I am stuck at a key point. I am writing a simple client-server program in Python that is supposed to accept key/value pairs from the command line,...
python comprehension trubleshooting Question: base=2 digits=set(range(base)) key=range(base**3) dict={ k:[a,b,c] for k in key for a in digits for b in digits for c in digits} print(dict) the output is: {0: [1, 1, 1], 1: [1, 1, 1], 2: [1, 1, 1], 3: [1, 1, 1], 4: [1, 1, 1], 5: [...
How to nest or jointly use two template tags in Django templates? Question: I'm trying to use template filters to do run a loop, but I'm unable to combine two python statements within the same statement/template. Whats the correct way to combine two variables in a template? Please see the syntax and explanation below: ...
Importing functions in R Question: In Python we have chance to import a certain function from a library with a command "import _function_ from _library_ **as smth**. Do we have something similar in R? I know that we can call the function like "_library_ ::_function_()", my question mostly refers to the "as" part. Ans...
Using csv training data in tensorflow RNN Question: I am fairly new to tensorflow, and did the obligatory MNIST tutorial successfully. I am trying to train a simple RNN with a set of CSV data. The data is 33 features and a binary output variable at the end (so 34 columns). I have implemented a csv reader that reads i...
Python paramiko: redirecting stderr is affected by get_pty = True Question: I am trying to implement an ssh agent that will allow me later, among other things, to execute commands in blocking mode, where output is being read from the channel as soon as it is available. Here's what I have so far: from p...
Split a 3D numpy array into 3D blocks Question: I would like to split a 3D numpy array into 3D blocks in a 'pythonic' way. I am working with image sequences that are somewhat large arrays (1000X1200X1600), so I need to split them into pieces to do my processing. I have written functions to do this, but I am wondering ...
Why is my function that I made getting the TypeError: f() takes 0 positional arguments but 1 was given Question: I am working with pandas DataFrames and I am adding new columns for more advanced analysis. My f function is giving me an error TypeError: f() takes 0 positional arguments but 1 was given. I can't figure out...
how can i correct this Regex phone number extractor in python Question: The results i'm getting when i run this after copying a set of UK phone numbers to the clipboard are coming out in a very bizarre kind of way. (i have imported both modules before you ask) phoneRegex = re.compile(r'''( (\d{5}...
python os.walk returns nothing Question: I have a problem with using `os.walk` on Mac. If I call it from `python terminal`, it works perfect, but if I call it via a `python script`, it returns empty list. For example: import os path = "/Users/temp/Desktop/test/" for _ ,_ , files ...
The last element (bitstring.BitArray) in list is incorrect after XORing python Question: I have snippet of code: #!/usr/bin/python3 from bitstring import BitArray import itertools # Helper functions def get_bitset_by_letter(letter, encoding): return encoding[letter]...
Transforming string output to JSON Question: I'm getting some data from an external system (Salesforce Marketing Cloud) over API and I'm getting the data back in the format below: Results: [(List){ Client = (ClientID){ ID = 113903 } PartnerKey = None ...
Setting scan coordinates in device options on pyinsane Question: I use Sane's command line utility (`scanimage`) in order to scan films from the transparency unit of my scanner. Here is the command that I have been using with success: scanimage --device-name pixma:04A9190D \ --source 'Transparency Un...
Encoding issue when writing to CSV file in Python Question: I have some encoding issue while writing an array to CSV. Code: import csv a = [u'eNTfxfwc', 'Pushkar', 'Waghulde', 'pushkar.waghulde@gmail.com', 'Los Angeles', '', 'UNITED STATES', '2652 Ellendale Pl # 9', '', 'Los Angeles, UNITED STATES',...
Python Error message when opening .txt file / change in working directory Question: I’m a new python user and have written a python script that prompts for the name of a text file (.txt) to be opened and read by the program. name = raw_input("Enter file:") if len(name) < 1: name = "test.txt"...
Replacing an item in list with items of another list without using dictionaries Question: I am developing a function in python. Here is my content: list = ['cow','orange','mango'] to_replace = 'orange' replace_with = ['banana','cream'] So I want that my list becomes like this after replacem...
former form fields no longer found by mechanize python script Question: Let me start by apologizing for my utter newbness. I was asked by a friend a couple years ago if I could write a program to automatically grab substitute teaching openings. It wasn't an area I knew anything about, but a couple tutorials allowed me ...