Data dodania Pytanie
2016-10-31 18:10 python's urlparse.urljoin removes path when concatenating »
Documentation of urlparse.urljoin, mentions that: "Informally, this uses components of the base URL, in particular the addressing scheme, the network ...
(0) odpowiedzi
2016-10-30 20:10 If statement not working for raw_input prompt »
Everything left out of what is shown is correct because I tested it before... no matter what i put, it still says "That is not a choice" which is my ...
(1) odpowiedzi
2016-10-29 13:10 Getting an IndexError: string index out of range »
Given a base-10 integer,n , convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n...
(2) odpowiedzi
2016-10-28 16:10 How to extract numbers from a list of strings? »
How should I extract numbers only from a = ['1 2 3', '4 5 6', 'invalid'] I have tried: mynewlist = [s for s in a if s.isdigit()] print mynewlist ...
(6) odpowiedzi
2016-10-28 10:10 Checking new mails of Gmail account through python »
I'm using this code to check for new mails with a 10 seconds delay. import poplib from email import parser import time def seeit(): pop_conn = ...
(1) odpowiedzi
2016-10-27 10:10 why cant i take * as a command line input n python(ubuntu linux)? »
when the variable operation is printed, i get the script name itself. *(asterisk) isn't being accepted as a command line argument. from sys import ar...
(0) odpowiedzi
2016-10-27 02:10 What does the "variable //= a value" syntax mean in Python? »
I came across with the code syntax d //= 2 where d is a variable. This is not a part of any loop, I don't quite get the expression. Can anybody enlig...
(3) odpowiedzi
2016-10-25 16:10 Separate aggregated data in different rows »
I have a panda's dataframe with the following structure: Date product count 0 2016-09-01 sugar 3 1 2016-09-01 pasta 4 2...
(0) odpowiedzi
2016-10-25 16:10 MQTT subscriber not working with Python 3.x (Works with 2.x) »
I'm going through an MQTT/Mosquitto tutorial and have it working with python2, but only the publisher works with python3. I ran the exact same code i...
(0) odpowiedzi
2016-10-24 21:10 Set literal gives different result from set function call »
Why does the set function call wipe out the dupes, but parsing a set literal does not? >>> x = Decimal('0') >>> y = complex(0,0) &g...
(2) odpowiedzi
2016-10-24 20:10 Putting two keys with the same hash into a dict »
>>> one_decimal = Decimal('1') >>> one_complex = complex(1,0) >>> d = {one_decimal: '1D', one_complex: '1C'} >>> m...
(3) odpowiedzi
2016-10-22 00:10 Why is __hash__ not inherited when __eq__ is provided? »
The following code works in python 2.7, but fails in python 3.5: class Base(object): def __hash__(self): return 4 class Derived(Base): p...
(0) odpowiedzi
2016-10-21 18:10 Is there any implementation of Python2 where ordering is transitive? »
Is there any existing implementation of Python2 where ordering is transitive? That is, where it's impossible to see this behaviour without creating u...
(2) odpowiedzi
2016-10-21 00:10 Sort a list of reversed objects »
I was looking for a way to do a reverse-lexicographical sort without using a lameda function, and noticed something odd when using reversed: >>...
(1) odpowiedzi
2016-10-20 18:10 Combine unknown amount of lists, keep only common values »
I want to combine N lists and keep only the values that are in every single one of them. I don't know how many lists there are, so the code must be dy...
(2) odpowiedzi
2016-10-20 16:10 Python on Raspberry Pi user input inside infinite loop misses inputs when hit with many »
I have a very basic parrot script written in Python that simply prompts for a user input and prints it back inside an infinite loop. The Raspberry Pi ...
(0) odpowiedzi
2016-10-18 10:10 Recursive dictionary walking in python »
I am new to python and trying to create a recursive dictionary walker that outputs a path to each item in the dictionary. Below is my code including ...
(1) odpowiedzi
2016-10-14 16:10 Kivy scrollbar scroll direction with mouse »
Is there a way to change the scroll behavior of Kivy scrollbars when using a mouse? With a mousewheel, the contents of a DropDown or Spinner scroll u...
(1) odpowiedzi
2016-10-14 10:10 type 'set''s difference between __str__ and printing directly »
In [1]: import sys In [2]: sys.version_info Out[2]: sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0) In [3]: b=set([10,20...
(1) odpowiedzi
2016-10-14 06:10 Python 2 decimal division unexpected results »
I am trying to do the calculation Using the python decimal module with the following code: from decimal import * getcontext().prec = 9 sum = Decim...
(2) odpowiedzi
2016-10-13 21:10 Use eval with dictionary without losing imported modules in Python2 »
I have a string to be executed inside my python program and I want to change some variables in the string like x[1], x[2] to something else. I had pre...
(1) odpowiedzi
2016-10-13 13:10 Do something else when reached last line of CSV »
I want to do something else when the for-loop has reached the last line, I found some examples online but they all ruined the rest of the code. I want...
(0) odpowiedzi
2016-10-13 10:10 Python how to decode unicode with hex characters »
I have extracted a string from web crawl script as following: u'\xe3\x80\x90\xe4\xb8\xad\xe5\xad\x97\xe3\x80\x91' I want to decode u'\xe3\x80\x90\x...
(3) odpowiedzi
2016-10-12 21:10 how to change the user password of a mongodb user using pymongo »
how can I change the password of a given username in a given authenticationDatabase using pymongo? so what I want to do is somehow do a db.changeUse...
(0) odpowiedzi
2016-10-12 17:10 Capturing traceback from R when an RRuntimeError is raised »
A Python class executes R functions via rpy2, and I would like to be able to capture the traceback from R in the event that an R function generates an...
(2) odpowiedzi
2016-10-12 10:10 How to convert huge binary data into ASCII format? »
I want to read a file which contains huge binary data. I want to convert this binary data into ASCII format. At the time of start, I want to read 2 by...
(3) odpowiedzi
2016-10-07 21:10 Pandas, convert aggregated dataframe to list of tuples »
I am trying to obtain a list of tuples from a panda's DataFrame. I'm more used to other APIs like apache-spark where DataFrames have a method called ...
(1) odpowiedzi
2016-10-07 21:10 python multiprocessing returning error 'module' object has no attribute 'myfunc' »
First off, I am very new to multiprocessing, and I can't seem to make a very simple and straightforward example work. This is the example I working wi...
(1) odpowiedzi
2016-10-07 17:10 Removing DataFrame rows in Pandas based on column type »
I have a Panda's DataFrame and in an specific column, there are some values of different type than the desired one. I've tried to use a similar approa...
(1) odpowiedzi
2016-10-06 20:10 How do I loop through a tuple of lists element-wise? »
I have a function that returns a tuple of two lists def two_lists(): return [1, 2, 3], ['a', 'b', 'c'] I want to loop through the tuple in a ma...
(1) odpowiedzi
2016-10-06 19:10 List of dictionaries gives error in python3.5 and works properly in python2.7 »
The following program gives error in python3.5 and gives proper output in python2.x a = [{'1': [1,11,21]}, {'2': [2,12,22]}] for i in a : print (...
(0) odpowiedzi
2016-10-05 16:10 Python Imports failing. Relative imports, package recognition, __init__.py , __package__, __all__ »
I've been reading a lot of threads, the PEP articles related to this problem, which are around 4 of them, but none of them gives a clear idea on some ...
(2) odpowiedzi
2016-10-04 12:10 conversion from radian to degree [python 2] »
What is wrong with following piece of code import math n = input () l = int(round((n*180)/math.pi)) print l Gives wrong answer. if n = 0.7071067811...
(1) odpowiedzi
2016-10-04 01:10 Does the import system save the parsed `# coding: ` declaration anywhere? »
I've the following code in rknzcyr.py: # coding: rot13 vzcbeg flf pheerag_zbqhyr = flf.zbqhyrf[__anzr__] qrs trg_zbqhyr_rapbqvat(zbqhyr): pbqva...
(0) odpowiedzi
2016-09-30 11:09 Switching between python2 and python3 as the default python »
Is there a standard way to switch between python2 to python3 as the default python, similar to how virtualenv can be used to switch between different ...
(4) odpowiedzi