Data dodania Pytanie
2017-06-19 16:06 Why is there almost always a folder called 'bin' in a python project? »
I keep seeing this in places. People tend to put stuff in a folder called bin, but I don't understand why. This is a folder structure I see often. my...
(0) odpowiedzi
2017-06-19 11:06 python replaces symbols with '?' »
In windows terminal I run python and execute: [ord(i) for i in u'Йож'] # three_national_symbols And output was [63, 63, 63] Could anyone expl...
(0) odpowiedzi
2017-06-16 06:06 What is a good way to layer like this in pygame? »
I've been working on a small project in pygame. It's an overhead 2D game, but if a player is behind an object, I need the player to be one layer behin...
(2) odpowiedzi
2017-06-15 13:06 Why are instances of old style classes instances of `object`? »
In Python 2, why are instances of old style classes still instances of object even when they do not explicitly inherit from object? class OldClass: ...
(0) odpowiedzi
2017-06-14 10:06 Paramiko.transport:oops, unhandled type 3 »
I am trying SSH connect using python paramiko with key file. But i get an exception. import paramiko,logging logging.basicConfig() ssh = paramiko...
(0) odpowiedzi
2017-06-09 06:06 How to json.dumps byte object in python3 »
In python2 import json a = {"text": u"你好".encode("gbk")} json.dumps(a, ensure_ascii=False) >>> Out: '{"text": "\xc4\xe3\xba\xc3"}' I ...
(1) odpowiedzi
2017-06-08 21:06 Numpy Matrix Syntax - Are there differences between python2 and python3 »
I have an algorithm that was written and tested with Python2.5. It is purely matrix operations. Did the numpy matrix operations syntax change going fr...
(0) odpowiedzi
2017-06-07 22:06 Is_Integer returning incorrect result - Python 2.X »
dig = 16807 digcount = len(str(dig)) minroot = dig ** (1 / float(digcount)) print minroot print minroot.is_integer() minroot returns as 7.0 as a fl...
(3) odpowiedzi
2017-06-07 11:06 How to create a loop to extract data from a .csv file »
I face this issue and can't seem to find a fix except with Scipy or Numpy, both of which I don't wanna use in this case. From a .csv file, I want to ...
(0) odpowiedzi
2017-06-07 09:06 Why is it impossible to mix Python2 with Python3? »
Despite all that has been said and written on Python2 vs Python3, I have been unable to identify why the developers made it impossible to mix Python2 ...
(2) odpowiedzi
2017-06-03 09:06 Create large DataFrame with limited resource(RAM) »
I have a very large pandas.Series of shape (200000, ) containing dict(s) In[11]: series.head() Out[12]: train-1 {u'MI vs KKR': 7788, u'India...
(1) odpowiedzi
2017-06-01 11:06 How to add package path for python2 and python3 separatly? »
I know that set the environment variable PYTHONPATH works. However, it works for both python2 and python3. How could I set a path only for python3? ...
(0) odpowiedzi
2017-05-25 23:05 I'm trying to add a method to a class using a wrapper that takes in some attributes »
I'm trying to add a wrapper that would add a method to a class that would return the value of the argument passed in to the wrapper, here is what I'd ...
(0) odpowiedzi
2017-05-24 07:05 none type object has no attribute b error »
class Employee: def __init__(self, name, salary,b): self.name = name self.salary = salary self.b=b def displayCount(self)...
(0) odpowiedzi
2017-05-23 17:05 While Loop Counter Does Not Stop »
def individual_question_scores_pretest(): question_number = 1 for name in students: print("Now we will input the scores for %s: " % name) ...
(1) odpowiedzi
2017-05-21 10:05 Write a program that prints the integers from 1 to 100 (inclusive) in one line of code, however »
I am new to python and would like to write a program that prints the integers from 1 to 100 (inclusive) in 1 line using python, however: For multipl...
(2) odpowiedzi
2017-05-19 15:05 one-liner reduce in Python3 »
In Python3, I am looking for a way to compute in one line a lambda function called on elements two by two. Let’s say I want to compute the LCM of a ...
(2) odpowiedzi
2017-05-16 04:05 Python TKinter row of images background »
Issue: Why does this code not produce a row of 5 images? Ive tried different combinations of pack, place and grid but I can't resolve the issue. I thi...
(1) odpowiedzi
2017-05-13 17:05 How to use variable as a nested dictionary item name? »
My script gets data from nested dictionary this way: wx = json.load(urllib2.urlopen('https://api.darksky.net/forecast/blabla.json')) wd = {} if 'ho...
(0) odpowiedzi
2017-05-12 22:05 How can i make python loop repeating two variables »
I want to make a loop which repeates two variables, variable1 is the header of database its only a static string as declared and variable2 is retrievi...
(2) odpowiedzi
2017-05-11 08:05 Element Tree Syntax Error (not well-formed with invalid token) »
I am trying to use the Element Tree modules but I end up to some Error which I can't understand. My code here is based on the Python documentation i...
(1) odpowiedzi
2017-05-10 21:05 Doesnt iterate over the file? »
I am trying to find the line in the outfile (of) that starts with the letters ATOM and then do something with it but unfortunately it doesn't iterate ...
(4) odpowiedzi
2017-05-09 15:05 Obtain bare code from marshal loaded string »
I actually have some marshal serialized data that gets executed using exec call. The problem is about the fact I'm trying to update the surrounding en...
(0) odpowiedzi
2017-05-08 16:05 "Maximum call stack size exceeded" error in Python2 programm »
I'm rather new to programming and currently in the starting phase of an python-mooc and one of the (optional) exercises is to write a programm to simu...
(2) odpowiedzi
2017-05-07 09:05 Getting no output after running python program »
I am supposed to write a class named Employee that holds the data of name, salary, and years of service. It calculates the monthly pension payout the ...
(2) odpowiedzi
2017-05-04 17:05 Python built-in max(), when 2 values are the same which one gets picked? »
I have a code that processes data based on some dates. Lets say: case1: values1 with date1 = '2002-02-01' values2 with date2 = '2004-02-01' case2:...
(2) odpowiedzi
2017-05-04 05:05 Split text to csv by other delimiter but maintaining the comma in each column »
I have a txt file containing pipe | delimited values, but unfortunately, I have encountered some errors , the csv DictReader assumed that the comma in...
(1) odpowiedzi
2017-05-03 10:05 Rebase csv file by merging a base csv file with another new csv file »
I am currently working with two csv files, base.csv and another csv file, output_20170503.csv which will be produced everyday, so my aim here is to re...
(2) odpowiedzi
2017-05-03 09:05 Unknown spaces in output of python script after postgresql database query »
I am trying to execute a query from postgresql database using the psycopg2, but my problem here is the output I get contains unknown spaces, Here is ...
(1) odpowiedzi
2017-05-03 05:05 Install Numeric (old numpy) and old version of Python (e.g. Py 2.4) »
I have some very old Python code (written around the time of Python 2.2/2.3 and using Numeric libraries which I understand were the precursor to Numpy...
(0) odpowiedzi
2017-05-02 12:05 Syntax error only in python 3 »
I have the following code which runs fine on python 2 but throws error on python 3 import sys if sys.version_info > (3,): #print("Python 3") #...
(2) odpowiedzi
2017-04-29 21:04 How to change an element in a list and keep it that way forever in the code? »
I already know how to change an element of a list into another one: data = ["foo","bar","baz"] for i in xrange(len(data)): if data[i] == "foo": ...
(3) odpowiedzi
2017-04-28 16:04 Regular expressions with non-english unicode phrases using re.compile »
I want to return true or false, by asking whether a string includes unicode characters (in short sequences like phrases). words = ['你好朋友','
(2) odpowiedzi
2017-04-28 07:04 Tkinter not displaying to root when inside a class definition »
Trying to understand why Tkinter will display this image in the main method, but not when the root = Tk() variable is passed into a class. The display...
(1) odpowiedzi
2017-04-28 02:04 Python 2 import builtin »
I need to make code compatible for Python2/3 and it uses the dict() builtin, but I can't figure out how to import it from the __future__ module. For ...
(0) odpowiedzi