Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
0answers
14 views
Python not looping properly over xml file
I'm having difficultly getting python to loop / iterate over an xml file. I am able to load the file and get to each element, but the variable assignment (inside an inner loop) never seems to move ...
-2
votes
1answer
33 views
Self-study assignment gone wrong. (PYTHON)
Word1 = input("Please type a word: ")
Word2 = input("Please type a word: ")
if len(Word1) + len(Word2)> 30:
print("Words are to long")
# exit -- Gotten rid of.
30 - (len(Word1) + len(Word2) ...
0
votes
0answers
2 views
AWS boto sqs - why can't I post messages bigger than 196 000 bytes?
According to the SQS docs, it it possible to post messages up to 256KB of data. I configured my queue to 256KB of data, but when I post using boto, I max out at ~196 000 bytes. Anything over this, I ...
1
vote
3answers
30 views
Python boolean giving wrong answers
print 'a' in 'ab'
returns True
while,
print 'a' in 'ab' == True
returns False
Any guess why?
0
votes
1answer
5 views
Got a curious issue with paramiko and pycrypto
I'm working on a SFTP module in python, and have been using Paramiko and Pycrypto (i'm an amateur programmer, bear with me experts). I am building it in 2.7, but the error it gives me doesn't make ...
0
votes
0answers
6 views
How can I improve this code for checking if text fields are empty in WxPython?
I have a method GetEmpID that takes up to two optional arguments: lastname, and firstname. It handles cases where either lastname or firstname are None, or when neither are None.
When sending the ...
0
votes
1answer
18 views
Same Program Runs Fine when ran from IDLE but not when ran directly
I wrote a small Tkinter based GUI app on python. It worked fine when run with IDLE, but displays moduleError on running it directly. I am on windows. Running it directly means double-clicking the .py ...
1
vote
2answers
28 views
How to order a dictionary by the value types without importing modules. [python]
I'm trying to sort this dictionary:
dictionary = {24249:"t",390395:"b",90395:"q",5939:"z",1:"k",3909:"a"}
I've seen people use lambda to do this, but I'm trying to solve this problem by using only ...
0
votes
2answers
22 views
bat file running py script in different directory
I have a python script "cost_and_lead_time.py" in C:\Desktop\A. This script imports 3 other scripts and a "cost_model.json" file, all of which are in folder A.
Now, I have a simulation result in say ...
0
votes
0answers
11 views
Python package or process for updating and managing Unix config files
Questions similar to this have been asked, but most seem to focus on Windows .INI files.
I am interested in Unix config files. They usually have a pretty simple syntax: one line only per command, ...
0
votes
0answers
4 views
Python Matplotlib Basemap animation with FFMpegwriter stops after 820 Frames?
If I run the following code it just stops after 820 Frames. I tested this on both a Ubuntu 12.04 VM and on Linux Mint 15. Unfortunately there is no error message. The program just hangs after printing ...
0
votes
1answer
20 views
Python2.7 argparse.parse_known_args parsing incorrectly
background
I have a script where I am using parseargs to partially parse the input.
parser = argparse.ArgumentParser()
parser.add_argument("-c", action="store_true")
nspc = parser.parse_known_args()
...
0
votes
1answer
11 views
Identify DataFrame index object where a condition is met
How do I get an index object from my DataFrame when a specific condition is met, say for a given column?
The following returns a Series object with True/False values where some condition in the foo ...
3
votes
0answers
29 views
python numpy and memory efficiency (pass by reference vs. value)
I've recently been using python more and more in place of c/c++ because of it cuts my coding time by a factor of a few. At the same time, when I'm processing large amounts of data, the speed at which ...
2
votes
4answers
62 views
Python - Replacing letters in a string?
I am basically writing a simple function in which the user enters a sentence (strng), a letter (letter) and another letter (replace) to replace the first letter with. Here's what I have:
def ...