Tagged Questions
2
votes
2answers
36 views
Python is stating my file is not in the directory even though it is saved on my computer. what is wrong?
Assume that a file containing a series of integers is named numbers.txt and exists on the
computer’s disk. Write a program that calculates the average of all the numbers stored in
the file.
I ...
1
vote
0answers
15 views
Python 3 TCP/IP ascii command
I am trying to send an ascii command to my stepper drive (RV which is the move command).
but everything that I have tried ends up with Python (I think) adding an extra character to the beginning of ...
0
votes
1answer
20 views
How to manually sort a list of numbers in Python?
Specs: Ubuntu 13.04, Python 3.3.1
Background: total beginner to Python, came across this "manual sorting" problem.
What I was asked to do: "Have the user enter 3 numeric values and store them in ...
7
votes
1answer
46 views
What python 3 library should I use for MySQL?
As far as I know MySQLdb still isn't ported to Python 3.
There seems to be another library called PyMySQL on pypy but the installation for python 3 looks strange (run a .sh script?). Also there is a ...
0
votes
4answers
41 views
Replace list number values with others?
I have this code
start_list = [5, 3, 1, 2, 4]
square_list = []
for number in start_list:
number = number**2
#I bet something should be added here but
#I have no idea what that would be
...
0
votes
2answers
53 views
Calling python script from C++ and using its output
I want to call a python script from C++ and wish to use the output .csv file generated by this script back into C++. I tried this in main():
std::string filename = "/home/abc/xyz/script.py";
...
0
votes
0answers
16 views
How to fix seemingly random line skipping with curses?
I am attempting to make a simple tui wrapper around curses in python3. This is for a rougelike game I am trying to make. As far as I can tell my code is correct, except for maybe some curses settings ...
1
vote
3answers
34 views
Write key to separate csv based on value in dictionary
[Using Python3] I have a csv file that has two columns (an email address and a country code; script is made to actually make it two columns if not the case in the original file - kind of) that I want ...
0
votes
1answer
17 views
floating numeric value read as timedate using openpyxl
I have an Excel spreadsheet that has a field containing small %f.2 values, such as 1.2, 1.07, 2.3, etc and for some reason openpyxl is reading these cells as a 1900 date. I have seen a variety of ...
8
votes
1answer
149 views
Is “join” slower in 3.x?
I was just messing around when I came across this quirk. And I wanted to make sure I am not crazy.
The following code (works in 2.x and 3.x):
from timeit import timeit
print ('gen: %s' % ...
0
votes
1answer
38 views
For Loop inside Function using a List: not iterating
Hello :) In the typing practice program I am creating in python 3, I have a for...loop that takes the characters from a global list of a certain paragraphs characters and compares it to the character ...
0
votes
2answers
15 views
PowerPoint & Python: Editing PPT fails when an image is reached
I am putting together a python script that will "clean up" a PowerPoint file's font-face, font-colors, font-size, etc. I found a snippet of code that does what I need it to do, however it seems to ...
0
votes
1answer
18 views
Issue with multiple sessions
In my application I'm using SQLAlchemy for storing most persistent data across app restarts. For this I have a db package containing my mapper classes (like Tag, Group etc.) and a support class ...
1
vote
2answers
47 views
Random String Generation Based on Regular Expression-Python
According to the this random strings can be generated importing rstr module.
import rstr
rstr.rstr('ABC')
but when I compile this following error is given?
ImportError: No module named rstr
I'm ...
3
votes
2answers
80 views
How do I compare two nested data structures for unittesting?
For those who know perl, I'm looking for something similar to Test::Deep::is_deeply() in Python.
In Python's unittest I can conveniently compare nested data structures already, if I expect them to be ...