Data dodania Pytanie
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
2017-01-13 07:01 How to slice a python pandas dataframe with 1200 rows into 12 equal parts? »
How to slice a python pandas data-frame with 1200 rows into 12 equal parts? either in Python2 or Python 3 ...
(1) odpowiedzi
2017-01-12 03:01 PyGame Sprites Occasionally Not Drawing »
I am trying to make a basic card game using PyGame. I am currently just trying to draw a single card to the screen. The weird thing is, occasionally i...
(1) odpowiedzi
2017-01-11 13:01 cannot run powershell script with pywinrm »
Here we can see examples: https://github.com/diyan/pywinrm how to control windows through pywinrm and powershell script it's work. but in case ps_sc...
(1) odpowiedzi
2017-01-10 20:01 ruamel.yaml formatting of TimeStamp after deepcopy seems broken »
import copy import ruamel.yaml d = ruamel.yaml.round_trip_load("foo: 2016-10-12T12:34:56\n", preserve_quotes=True) d2 = copy.deepcopy(d) assert ruame...
(1) odpowiedzi
2017-01-09 09:01 Randomly calling functions to execute »
I have made this short questionnaire: from random import randint def pancakes(): q = raw_input("Do you like pancakes?") if q == "yes": ...
(3) odpowiedzi
2017-01-09 08:01 Run interactive Bash with popen and a dedicated TTY Python »
I need to run an interactive Bash instance in a separated process in Python with it's own dedicated TTY (I can't use pexpect). I used this code snippe...
(2) odpowiedzi
2017-01-06 18:01 Python overwriting variable in script 1 with user input from script2 »
I've been struggling with this for several days now, and I cant find any answers that actually relate to what I'm trying to do, at least none that I c...
(1) odpowiedzi