Data dodania Pytanie
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
2017-09-03 18:09 opening a file with an accented character in its name, in Python 2 on Windows »
In a directory in Windows I have 2 files, both of them with an accented character in its name: t1û.fn and t2ű.fn; The dir command in the Command Pro...
(1) odpowiedzi
2017-09-02 02:09 How to Properly Reference a Variable in a Class for Use in Another Class? »
I'm self-learning Python 2 and I'm currently working on a OOP Blackjack game. I want to properly reference a variable in a class for use within anoth...
(2) odpowiedzi
2017-09-02 01:09 csv.writer with a single quote character »
I have a row of data that I am trying to write to a .tab file that looks like this: row = ['07/19/2017/10/33/30', 'gg_ca_18" dishwashers_204454792491...
(3) odpowiedzi
2017-08-31 07:08 getting Unicode decode error while using gTTS in python »
While using gTTS google translator module in python 2.x, I am getting error- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python...
(1) odpowiedzi
2017-08-30 16:08 How to know MRO in python2 »
In python3, we can use '__mro__' to get the method-resolution-order like below: >>> class a: ... pass ... >>> a.__mro__ (<...
(1) odpowiedzi
2017-08-30 09:08 Subpackages and relative imports in PyCharm »
I am using python 2: python --version Python 2.7.13 :: Continuum Analytics, Inc. I have the following project structure: . └── foo ├
(1) odpowiedzi
2017-08-30 06:08 Unbound method error in my code »
Class test: a=10 b=20 Def c(self,a,b): Return a+b Print test.a #10 Print test.b #20 Print test.c(1,2) #Error unbound method c() ...
(2) odpowiedzi
2017-08-28 13:08 how can i use input as a txt file in hexstring in this program to convert hex to dec »
how i edit this code that in hexString i can use input as a txt file which can contains hexstrings def main(): hexString = "4f3343" print ...
(1) odpowiedzi
2017-08-26 17:08 TkMessageBox doesn't close after clicking OK »
I have the following code, which should open a popup window. Now, if the user click "Yes" in the popup, it should show the main program window, and ot...
(0) odpowiedzi
2017-08-25 23:08 Alternating product of two lists »
If I use itertools.product with two lists, the nested for loop equivalent always cycles the second list first: >>> from itertools import pro...
(1) odpowiedzi
2017-08-25 14:08 Python 2 Reversed Efficiency »
While I imagine it may technically be implementation dependent, I'm wondering if reversed on Strings in Python 2 works as a generator object that just...
(0) odpowiedzi
2017-08-25 01:08 How to extract a key value pair from a nested dictionary and output it in json »
I am extracting part of a dictionary with with open(output_filename, "w") as outfile: json.dump(data['metadata'], outfile) So that I get the va...
(1) odpowiedzi
2017-08-20 17:08 Struggling to handle emoji in tweepy script due to encoding issues »
This is killing me and I'm really struggling with it... but I have a utf-8 related issue with Python. Essentially I am trying to pull stuff from csv ...
(0) odpowiedzi
2017-08-20 15:08 exec() with nested loop in list comprehension inside function error »
exec() from inside a function gives a different output, even I pass all the parameter needed to that function. Consider this code: def list_filter(ex...
(1) odpowiedzi
2017-08-16 10:08 No module named soundfile »
Whenever I try to import soundfile I get the error ImportError: No module named soundfile I installed pysoundfile seemingly without trouble: $ sud...
(2) odpowiedzi
2017-08-14 07:08 Is it possible to upload precompiled python package on web server? »
I'm working on a web application which requires PIL or Pillow python package. I have a shared hosting account on Namecheap on which they provide suppo...
(0) odpowiedzi
2017-08-12 16:08 How to determine if a string is escaped unicode »
How do you determine if a string contains escaped unicode so you know whether or not to run .decode("unicode-escape")? For example: test.py # -*- c...
(3) odpowiedzi
2017-08-10 22:08 How can I change a local variable assigned to the value of a global one without changing the global variable? »
So this is basically how the code works that I'm using. global Gvar Gvar = ["Hello"] def someFunction(): Lvar = Gvar Lvar.append("World") ...
(2) odpowiedzi
2017-08-10 12:08 Proper way to import battery-included objects in python3, but user-defined in python2? »
Let's take redirect_stdout context-manager from contextlib module for example, which is available in python3, but not in python2. I want my project to...
(0) odpowiedzi
2017-08-09 16:08 How to pass args from entries to method from outside script using Python 2.x? »
I am stuck on this problem and no amount of internet searching and tutorials have been able to help get to the bottom of it. I am new to Python. My g...
(0) odpowiedzi
2017-08-09 15:08 How to convert some code Python2 to Python3.x? »
I'm working with animation in my game, but I've got an error.. Can you help me pls?) Or do I need to add all of my code? class Animation: def __...
(1) odpowiedzi
2017-08-08 22:08 YourName Code (Traceback Error) »
I'm trying to find out why I'm getting a Traceback Error on this very simple code. I'm using 2.7.13. # YourName.py name = input("What is your name...
(0) odpowiedzi