Data dodania Pytanie
2017-02-18 15:02 Django mocking storage on model with update() throws error »
I have a small project and I'm working on some tests. Recently I asked a question: django-test-mocked-imagefield-prevent-upload-or-clean-after-test. I...
(0) odpowiedzi
2017-02-17 21:02 Strange Python boolean operator »
I saw some variations of the following simple piece of code: if dist_1>dist_2 : print enemy_2 else: print enemy_1 Variation 1: print (...
(2) odpowiedzi
2017-02-17 19:02 Where is console input history stored on Python for Windows? »
Good afternoon, The Question Is there a particular spot that the entries are stored, or is it just a local set of stored variables, for the windows ...
(0) odpowiedzi
2017-02-16 07:02 Django Test mocked ImageField prevent upload or clean after tests »
I am working on a TestCase for my project, involving some Image and FileFields. Some objects are loaded with fixtures, some objects are created during...
(1) odpowiedzi
2017-02-13 18:02 Python: indexing - Project Euler 8 »
When trying to answer this question using python, I ran into a problem with the indexing on the list I created. The question is: What is the greates...
(1) odpowiedzi
2017-02-12 15:02 How to append a new list to an existing CSV file? »
I already have a CSV file created from a list using CSV writer. I want to append another list created through a for loop columnwise to a CSV file. Th...
(2) odpowiedzi
2017-02-12 08:02 python class calls itself in __init__ using super »
i have a code like this: class sampleClass(object): def __init__(self): super(sampleClass, self).__init__() my question is that why it ...
(1) odpowiedzi
2017-02-11 22:02 python function with a pass in it »
in many codes, i see classes with functions in them that they just used pass phrase with some comment upon them. like this native builtin function fro...
(2) odpowiedzi
2017-02-11 03:02 Concurrent futures submit task to process pool non-blockingly »
This question is Python 2-specific, using the community maintained backport of concurrent.futures. I'm trying to use a ProcessPoolExecutor (with maxW...
(0) odpowiedzi
2017-02-10 00:02 Prevent type coercion when using string template formatting »
>>> b'potato {} potato'.format(u'potato') # return value matches the template 'potato potato potato' >>> b'potato %s potato' % u'p...
(1) odpowiedzi
2017-02-07 16:02 Installing Ambari MPack Fails Python Usage Message »
Trying to install Amabri Management Pack and i cannot get the command to run ambari-server install-mpack --mpack=http://public-repo-1.hortonworks.com...
(1) odpowiedzi
2017-02-07 09:02 Python Query (Lottery project) »
I have a query relating to return only the last results, so here is my code: import random def Step_1(): Start_Game = raw_input("Ente...
(1) odpowiedzi
2017-02-06 21:02 Delete newline at end of for loop -- python 2.x »
I have been doing exercises on codeabbey.com to brush the rust off, and I keep running into this small, but still frustrating problem. I want my progr...
(1) odpowiedzi
2017-02-03 20:02 Can Applescript or Python give me the Fully Qualified Path to a local file? »
UPDATE: I guess what I really need to be able to do is to determine the Volume Name of the Boot Drive under Mac OS. As an explanation of what I mean ...
(1) odpowiedzi
2017-02-03 19:02 Can os.walk() be used on a list of strings? If not, what would be the equivalent? »
Instead of using a real file structure, is it possible to give it a premade list of strings to have it create a nested list of paths/files for you? E...
(1) odpowiedzi
2017-02-03 04:02 How would I create a list based on matching path strings in Python? »
I'm basically trying to seperate file path strings into lists of files in the same path. Lets say I have this list: files = ['user/hey.jpg','user/fol...
(4) odpowiedzi
2017-02-02 16:02 Python2 - Can I overwrite stdout with multine? »
I made a little Conway's game of life in Python2 (Because I can't use Python2), but to improve my output I want to overwrite the stdout. I know that ...
(0) odpowiedzi
2017-02-01 23:02 Convenient way to add lambda functions together? »
Let's say I have this function in a python module: def functionmaker(a,b): return lambda x: (a*x) + b Now let's say I am given a list of this ...
(2) odpowiedzi
2017-02-01 22:02 Jython exceptions that subclass java.lang.Exception have an intermediary proxy subclass? »
I wanted to look at the behavior of subclassing a standard Java Exception class in Jython, and I noticed this: C:\tmp>java -jar c:\app\java\lib\jy...
(0) odpowiedzi
2017-02-01 18:02 assert variable is threading._Event protected class instance »
I want to check that a a variable e is an instance of threading.Event. However, when I create e, it actually creates a protected class instance thread...
(1) odpowiedzi
2017-01-31 15:01 Unicode Cyrillic strings in Python 2.7 »
I've got a piece of Python 2.7 code that returns a webpage encoded in UTF-8. It essentially does this: arequest=urllib2.urlopen(request.httprequest...
(2) odpowiedzi
2017-01-29 14:01 super() takes at least 1 argument (0 given) when cleaning data in form »
Trying to validate input in my form and I am getting super() takes at least 1 argument (0 given) cleaning a form class LeaseTermForm(forms.Mo...
(0) odpowiedzi
2017-01-26 01:01 How to Use Getter Without Setter »
I am using python 2.7. I have the following class: class Test: def __init__(self): self._pos_a = ['test_1'] self._pos_b = ['tes...
(1) odpowiedzi
2017-01-25 18:01 Can't access Python function as attribute »
Imagine I have the following test.py file import foo class example1(object): MyFunc = foo.func Where foo.py is def func(): return 'Hi...
(3) odpowiedzi
2017-01-25 17:01 Inconsistent number parsing python2? »
In Python different systems for representing numbers are allowed: >>> 11 # Decimal 11 >>> 011 # Octal 9 >>> 0x11 # Hexadec...
(1) odpowiedzi
2017-01-24 17:01 How to format date in python »
I made a crawler using python. But my crawler get date in this format: s = page_ad.findAll('script')[25].text.replace('\'', '"') s = re.search(r'\{...
(4) odpowiedzi
2017-01-23 15:01 Is it possible to run parts of a code in python 2.x while the rest is written in python 3.x? »
Is it possible to have python 3.x code and to execute 2.x code (e.g. a function call) in it? #Code written in python 3.x . . . . . . #This is the p...
(1) odpowiedzi
2017-01-23 06:01 urllib.parse I am trying to parse a url however it is parsing part of it and not all »
here I have a url: https://www.httpbin.org/get?course=networking&assignment=1 and I want to parse it so that I can do something like this: remo...
(1) odpowiedzi
2017-01-22 21:01 How to carry out to 3 decimals rather than ints in the list? »
So a list from 0 to 100 is created and I apply the formula in line two to make list B. The issue is that it's rounded to an int and I have been trying...
(2) odpowiedzi
2017-01-20 10:01 Encoding in a list of dict »
I have a list mylist of dict with an encoding problem: >>print mylist [{u'param1': u'foo',u'param2': u'Special char \xe9'}, ...] >>for i...
(1) odpowiedzi
2017-01-19 17:01 Maya Python skinCluster return type not string? »
I'm trying to check if an object has a skinCluster on it. My code is pretty basic. Here's an example: cmds.select(d=True) joint = cmds.joint() skinne...
(1) odpowiedzi
2017-01-19 05:01 read() differences between python 2 and python 3 »
With the following MWE: with open('a','w') as f: f.write('\r') with open('a','r') as f: print(ord(f.read())) I get the following output: $...
(1) odpowiedzi
2017-01-18 08:01 Better way to write a polling function in python »
I wrote a polling function to check the value of reg_result variable for 120 seconds. reg_result = 0 while_timeout = time.time() + 120 while reg_resu...
(1) odpowiedzi
2017-01-17 09:01 Reshaping an outputted 1 dimensional numpy array into a 2/3 dimensional array »
So I'm using an image's pixel data, applying some calculations to it, which gives me a resulting array whose shape is unknown until the calculations a...
(0) odpowiedzi
2017-01-14 16:01 python 2 with opencv 3 - detect object by color »
I'm trying to detect object by color, and get some "information" about the object - like size and position. So far I just did this import cv2 import ...
(0) odpowiedzi