Data dodania Pytanie
2017-07-02 02:07 OS.system- adding the output of OS .system output command to the command of another os system command »
I can use only python 2.6.6 and subprocess is not working so I need to use only os module Below is the program import os server = raw_input("serve...
(0) odpowiedzi
2017-06-29 19:06 How can I make my email show only one time per email? »
I've been making a Python script which checks for emails since logging in. Here is my code so far: #!/usr/bin/python import imaplib, getpass mail = ...
(2) odpowiedzi
2017-06-29 00:06 How can I elide a function wrapper from the traceback in Python-3? »
The issue The Phantom Menace Say i wrote a function decorator which takes the function, and wraps it in another function like so: # File example-1....
(1) odpowiedzi
2017-06-28 22:06 CONVERSION OF COORDINATES IN UTM TO GEOGRAPHICAL USING PROJ's LIBRARY »
Tengo un problema al momento de ejecutar mi programa. Necesito convertir coordenadas en el sistema utm a geograficas, estoy usando el sistema WGS84 co...
(0) odpowiedzi
2017-06-28 14:06 Convert 2 integers to hex/byte array? »
I'm using a Python to transmit two integers (range 0...4095) via SPI. The package seems to expect a byte array in form of [0xff,0xff,0xff]. So e.g. 1...
(1) odpowiedzi
2017-06-27 21:06 Python 2 vs Python 3 double underscore methods »
So in Python 3, I can use object().__eq__. I'm currently using it as a mappable function, equivalent to lambda x: x is object(). I'm using it as a se...
(1) odpowiedzi
2017-06-27 15:06 Python re match only letters from word »
I am new to Python re, but I need help. I searched here, google, documentation, but nothing worked. So here is what I am trying to do. I have word (f...
(4) odpowiedzi
2017-06-24 07:06 List of logging levels compatibility between Python 2 and Python 3 »
To have a list of logging levels in Python 2 I have to call this: logging._levelNames.keys() While Python 3 logging module has this: list(logging....
(1) odpowiedzi
2017-06-22 15:06 Ambiguity in basic arithmetic operations Python »
Here is the scenario: In [5]: (2.0 - 5.0**(0.5)) ** (1.0/3.0) --------------------------------------------------------------------------- ValueError ...
(1) odpowiedzi
2017-06-21 22:06 Python: Saving list in a file without quotes? »
I'm working with a couple text files using csv module and I encountered something strange that I can't understand. My code so far: import csv with o...
(4) odpowiedzi
2017-06-20 17:06 How to import without using "import" in python »
The context of this question is that I am trying to write a program for assist in analysis of data. It should be written in python3, however the kind ...
(2) odpowiedzi
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