Tagged Questions
-2
votes
0answers
21 views
parse json find row by value in certain key of an array - python
I I have an array of json objects like this
[{"id":21,"username":"prerrit.kumar","email":"[email protected]","name":"Prerrit ...
-2
votes
1answer
22 views
Nonblocking client-server in python
I have been coding a blocking client-server in python. how can I change it to nonblocking without thread?
0
votes
1answer
19 views
Checking a file modification date/time against one stored in memory?
I'm looking for some help to do:
1) Get the modification date/time of a file
2) Compare against the same file after a sleep of 10 minuites and if it's not different to play a beep:
import winsound
...
0
votes
1answer
19 views
“TypeError: 'str' object is not callable” with raw_input
I'm doing the exercises from Zed Shaw's "Learn Python The Hard Way", and exercise 16 just does not seem to want to work:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# reading and writing files
from ...
0
votes
2answers
37 views
Counting occurrences within list
I am loading numbers from a text file into a list, and in that regard, everything works fine! But now I need to know how many times each number occured in the list. Below is my whole program that I ...
4
votes
2answers
28 views
How to overcome memory issue when sequentially appending files to one another
I am running the following script in order to append files to one another by cycling through months and years if the file exists, I have just tested it with a larger dataset where I would expect the ...
0
votes
1answer
14 views
Making a class attribute into a string
I know what the problem is, i just don't know how to fix it. I've googled how to make a class attribute into a string and I can't find anything. I know it's trying to add a class attribute to a string ...
0
votes
2answers
32 views
Storing a string into a property
In my class, we are just starting object-oriented Python (we were doing functional programming since the beginning of the semester).
Write a new class called Sentence with the following methods:
...
2
votes
1answer
33 views
How to mock a function inside of another function?
I have been trying to mock this function call in another function with no success. How do I successfully mock this?
from mock import patch
from path.to.a import function_a
...
2
votes
2answers
23 views
Appending files to each other without adding the title row each time
Bonjour Stack0verflow
I am trying to get this code to write the data to stored_output without line 1 (title line)
What I have tried:
with open(filenamex, 'rb') as currentx:
current_data = ...
0
votes
3answers
25 views
I am trying to create a dictionary of characters that I read in from a text file in python
I can read an entire string but it doesn't count the individual chars.
Here is what I have:
#!/usr/bin/python2.7
ans = True
while ans:
print("""
1. Read in an text file.
Press enter ...
1
vote
3answers
31 views
zip based on true/false tuple in python
I'd like to have a variable which is made of ziped lists, but only those selected. That is,
selected = (True, True, False)
mylist1 = [1,2,4]
mylist2 = [4,5,8]
mylist3 = [3,2,7]
So, what I want is ...
0
votes
3answers
33 views
Issue with using the chr() method to add \x to characters in a list
I'm trying to send Hex data via sockets to remote hardware. The method I am using works for some data but not others, here is an example:
packet_list = ...
1
vote
1answer
21 views
Create “client in server” for send request for server
I want to create something like this:
And i didn't know, how to create "client in server" in Twisted, for send response to another server. I mean sheme:
for example, it was been write some file into ...
0
votes
3answers
12 views
Making loading animation script in Python 2.7
I am trying to make a python program that writes the follwing to a terminal:
Frame 1 -- Loading
Frame 2 -- Loading.
Frame 3 -- Loading..
Frame 4 -- Loading...
Frame 5 -- Loading
This would all be a ...