Tagged Questions
2
votes
2answers
43 views
Storing and loading numpy arrays as string
In my program I'm working with various numpy arrays of varying sizes. I need to store them into XML files for later use. I did not write them to binary files so I have all my data in one place (the ...
1
vote
1answer
44 views
How I can deserialize C# datetime in python?
I need to convert a date from c # to python. The data format is json. The data contained in the json formatted as: / Date (1373338800000). Must be transformed into a valid date for the python.
0
votes
1answer
26 views
Python to JSON Serialization
I'm using the following code to serialize my Python code to JSON:
def toJson(self):
return json.dumps(self, default=lambda obj: obj.__dict__, indent=4)
However, I'm trying to sort out the ...
1
vote
1answer
75 views
Django REST framework - Serializing and Deserializing a list of primitive types
The task at hand is to use a Serializer to serialize a list of primitive types lets say integers or strings, and then to deserialize this list again. This should be really easy but somehow I cannot ...
0
votes
3answers
59 views
Python's struct.pack/unpack equivalence in C++
I used struct.pack in Python to transform a data into serialized byte stream.
>>> import struct
>>> struct.pack('i', 1234)
'\xd2\x04\x00\x00'
What is the equivalence in C++?
4
votes
1answer
58 views
Why do int keys of a python dict turn into strings when using json.dumps?
According to this conversion table, Python ints get written as JSON numbers when serialized using the JSON module--as I would expect and desire.
I have a dictionary with an integer key and integer ...
0
votes
1answer
28 views
Effective timestamp serializing in Python
I got time stamp when I print time.time().
In [48]: print time.time()
1370898402.64
How can I serialize it as a string?
I thought about transforming it into a string as follows:
"%s" % time.time()
...
1
vote
1answer
119 views
how to unserialize this data with php?
I've got this data set which was probably serialised with php function serialize()
...
0
votes
1answer
34 views
serializing moderately complex Python structures in scipy.io.savemat [duplicate]
I need to save some data from Python and read it later with both Python and Matlab. The obvious choice seems to be scipy.io.savemat. But look what happens:
>>> a = {'foo': 0, 'bar': ...
0
votes
1answer
35 views
python encode/decoder for serialization/deserialization (Java's kyro equivalence in python)
I need to convert python value into byte array and vice versa.
For example:
Integer 256 -> [1, 1] // 256 = 1 * 255 + 1
String 'ab' -> [97, 98] // 'a' -> 97, 'b' -> 98
Floating point 1.23 -> [63, ...
1
vote
2answers
118 views
<Django object > is not JSON serializable
I have the following code for serializing the queryset;
def render_to_response(self, context, **response_kwargs):
return HttpResponse(json.simplejson.dumps(list(self.get_queryset())),
...
0
votes
0answers
36 views
How to implement a remote scheduler server using python
I wanna use python to implement a remote scheduler server which provide API for others to call. For example, user can make a POST request to url http://myurl.com/Jobs with data
{'job_name': 'Test1', ...
0
votes
0answers
22 views
python serialize the whole package?
although load_source of imp module is already removed from library docs (as of python 3.3), you can still use it to dynamically import python modules.
it has third optional parameter, a file(or ...
1
vote
1answer
54 views
Django caching - Pickle is slow
Working on optimization of one web-site, I found, that finally pickling of QuerySets becomes bottleneck in caching, and no matter how clever your code could be, unpickling of relatively large QS in ...
0
votes
2answers
46 views
Need way to unserialize objects from PHP in Python [closed]
I have a PHP serialized object that I need to un-serialize for use in Python. I know, it is not an open format but it is what I have to work with. I saw a topic that seemed to address this here but ...