Data dodania Pytanie
2017-09-25 16:09 __add__ two class objects »
I've been learning Python 2 by searching for tutorials. I'm discovering things about class. I have some trouble in __add__ dunder-method. I don't know...
(2) odpowiedzi
2017-09-25 01:09 Design Pattern to merge two implementations into one class »
I can't figure out the correct way to model this problem. Here I give you a minimalistic version of my code: # -*- coding: utf-8 -*- from abc import ...
(3) odpowiedzi
2017-09-25 00:09 TypeError: unhashable type 'list' when trying to download image by link »
Trying to save file by link, but face TypeError: unhashable type: 'list' import requests import lxml page = requests.get('https://karabas.com') for l...
(1) odpowiedzi
2017-09-24 14:09 Speed up multiple downloads with urllib2 »
I'm downloading multiple SMI files from a database called ZINC using a rather simple code I wrote. However, its speed doesn't look like so good consid...
(1) odpowiedzi
2017-09-24 14:09 ViewDoesNotExist at /myapp/ Could not import »
I'm tasked with a migration from 1.8 to 1.11, but I need to ensure I can at least get this site running in 1.8 (it's not my code) before the upgrade. ...
(1) odpowiedzi
2017-09-24 03:09 Does Pillow want my text parameters to be unicode or strings? »
The function in question: PIL.ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None) The issue is pretty standard... gibberish: Right ...
(1) odpowiedzi
2017-09-22 22:09 Confusion in using Super in Python »
I am getting an error for the program: class TennisPlayer(): def __init__(self, rank): self.rank = rank def slogan(self): pr...
(1) odpowiedzi
2017-09-22 00:09 How do I create an Or condition on a dictionary of elements in Python? »
dict = {a:[1,2,3,4], b:[4,5,6]} I would like to create a function func1 that takes in a dictionary as an argument def func1(dict, elem1, elem2): ...
(1) odpowiedzi
2017-09-20 08:09 python2 import from module of same name »
With the following directory structure: /util/myclass.py /tests/myclass.py how can I import a class that is defined in util/myclass.py from inside ...
(0) odpowiedzi
2017-09-20 05:09 NameError after using input in Python 2 »
I am learning Python this semester and this is my homework. Can anyone tell me why my code is wrong? QUESTION: You want to know your grade in Comput...
(4) odpowiedzi
2017-09-18 16:09 “iter() returned non-iterator” for dynamically bound `next` method »
Why does this next method I dynamically bound to an instance of a class fail and return a non-iterator object? from collections import Iterator from ...
(1) odpowiedzi
2017-09-18 16:09 Check if line is a dictionary type and print the data? »
I have .txt file and its loaded with a lot of text but in between 2-3 paragraphs there is a text like dictionary: somerandomtextinthisline {"key1":"v...
(2) odpowiedzi
2017-09-18 13:09 How to obtain the total sumation of an list and also its product using Numpy »
Hey guys I am a newbie at Numpy and am trying to learn but having issues. Lets say I have a list and I want to find the total and the product. I can d...
(1) odpowiedzi
2017-09-16 09:09 staircase "#" program in python, correct output but not qualifying default test cases »
Write a program that prints a staircase of size . Input Format: A single integer, n, denoting the size of the staircase. Output Format: Print a stai...
(3) odpowiedzi
2017-09-15 13:09 Unicode confusion #3423435 »
Once again I enter that goddamn unicode-hell ... sigh =( There are two files: $ file * kreise_tmp.geojson: ASCII text pandas_tmp.csv: ...
(2) odpowiedzi
2017-09-15 00:09 Why is this python class instance hashable? »
This is pertaining to python 2.x In the following class, if we subclass "object", I understand the methods are inherited in the derived class Foo whi...
(1) odpowiedzi
2017-09-13 21:09 Unbound local error: ("local variable referenced before assignment") »
import pandas as pd, numpy as np d = [{'Cabin': 'F G13'},{'Cabin': 'A32 A45'},{'Cabin': 'F23 F36'},{'Cabin': 'B24'},{'Cabin': nan}] df = pd.DataFrame...
(2) odpowiedzi
2017-09-13 20:09 Saving and Restoring a model using tensorflow »
I saved parameters of my neural network using this: parameters = { 'w_h1': w_h1, 'b_h1': b_h1, 'w_h2': w_h2, 'b_h2': b_h2, 'w_h3...
(1) odpowiedzi
2017-09-13 01:09 Cannot assign to list comprehension? »
I have been coding a game for a school assessment so excuse the basic code. My issue is that I am getting an error saying SyntaxError: can't assign to...
(1) odpowiedzi
2017-09-12 01:09 Numpy "double"-broadcasting - is it possible? »
Is it possible to use "double"-broadcasting to remove the loop in the following code? In other words, to broadcast across the entire time array T as w...
(2) odpowiedzi
2017-09-11 17:09 HTTP POST encoding "é" becomes "é" with Python and Requests »
I have an encoding problem. When I type the character 'é' in an input in a web browser, it is posted as 'é' which is fine. But when I try to post ...
(0) odpowiedzi
2017-09-11 11:09 Six's socket implementation »
I build an app compatible between Python 2 and 3. In order to provide compatibility between those two Python versions, I use six library. My code use...
(1) odpowiedzi
2017-09-11 09:09 python recursive add keys to dict when edit dict »
Need to change in dictionary d1['a']['b']['c'] = 1 but it is possible what d1['a']['b'] is nonexistent so must be recursively added Expected resu...
(0) odpowiedzi
2017-09-10 21:09 property() returns different values »
I am trying to fill the gap in my understanding of Pythons property(). Below is the code that I have come up with, to understand property(): class Te...
(3) odpowiedzi
2017-09-10 16:09 Wand and ghostscript issue on PyCharm »
So I have installed Wand, Ghostscript, ImageMagick. I am trying to convert a PDF to Image. My Code is as following. Code: from wand.image import Ima...
(2) odpowiedzi
2017-09-09 17:09 Getting an error while calling method of a class »
This is the error I am getting where it is telling me that next method isn't present. next() becoming next() in python 3.x. My code contains next me...
(0) odpowiedzi
2017-09-08 04:09 REVISED WITH COMMENTS v1: Multiprocessing on same dict/list »
I am fairly new to python, kindly excuse me for insufficient information if any. As a part of the curriculum , I got introduced to python for quants/f...
(2) odpowiedzi
2017-09-06 18:09 How to use psutil.Popen with unicode commands on Python 2 »
Hey I'm trying to execute the following command (using psutil.Popen with python 2.7): "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.E...
(0) odpowiedzi
2017-09-06 11:09 What is the pythonic way of "if possible, do it"? »
I wonder how it would be best/most pythonic to write the situation: if it can be done, do it. If not: just leave it. Example: I have a function that ...
(2) odpowiedzi
2017-09-06 02:09 Bind {} to future version of dict() »
I'm upgrading Python2 code to by compatible with Python3. As part of the process I'm using the future package to import Python3 behaviour into Python2...
(2) odpowiedzi
2017-09-05 21:09 Need to find element just before regex match element via python »
The input is exactly as below: "dinem-5554\tlee" I need to perform regex match to get the value before \tlee), that is, dinem-5554. This is what I'v...
(1) odpowiedzi
2017-09-05 11:09 super function is returning None along with result »
I have below code with parent class Test and subclass MyTest . From outside, i am trying to access the method of the parent class instead of subclass....
(2) odpowiedzi
2017-09-04 20:09 List Increment Not Taking Place Automatically In Python 3/2 »
I'm declaring an empty list and asking user for the input so that I can append that into the list. I also kept a counter for the user to tell maximum ...
(2) odpowiedzi
2017-09-04 16:09 3 condition python while loop regarding checking if two dates are the same »
I'm currently working on this problem of counting how many days between two dates including leap years. However it keeps skipping the loop from the be...
(1) odpowiedzi
2017-09-03 23:09 running a cmd file with an accented character in its name, in Python 2 on Windows »
I have the file t2ű.cmd on Windows with an accented character in its name, and I'd like to run it from Python 2 code. Opening the file (open(u't2\u0...
(1) odpowiedzi