Data dodania Pytanie
2016-12-05 11:12 Pass unicode instead of string from robot framework to python »
I have a robot framework file where I am calling a python function and passing it an argument. I want to pass the argument to python as a Unicode, but...
(1) odpowiedzi
2016-12-05 06:12 Python 2 and 3 compatible way to call intern() »
How do I write code that uses Python's intern that will work (be compatible) with both Python 2 and Python 3? Is there a clean way to do it? In Pyth...
(2) odpowiedzi
2016-12-03 11:12 I do not know how to define the two inputs (martian and plutonian) »
My code is simple yet the error has me baffled. The following is my code: from random import randint #I import the required modules for this program...
(0) odpowiedzi
2016-12-01 16:12 Use iteritems in a dictionary with datetime as key »
I have a dictionary update_fields that has key/value pairs where the value is another dictionary: {datetime.date(2016, 12, 2): {'t1030': 0, 't1045': ...
(3) odpowiedzi
2016-12-01 06:12 OpenCV/Python: Image contours don't appear »
I'm developing a script in OpenCV/Python that adding Tesseract reads something from an image. At the moment, I'm trying to implement the use of the fu...
(1) odpowiedzi
2016-11-30 21:11 Read text file over internet on python »
Here's a text file on the internet (http) http://hughchalmers.com/example.txt. How would I print that in Python 2? People are saying this is a duplic...
(2) odpowiedzi
2016-11-29 23:11 Convert txt file to int array »
I have a text file which looks something like: -45 64 -41 -51 95 96 -74 -74 56 41 41 64 -62 75 and I'm trying to convert it into an int ar...
(4) odpowiedzi
2016-11-28 13:11 hex2chars & chars2hex functions »
I have a function hex2chars: def hex2chars(data): result = ''.join(chr(int(data[i:i + 2], 16)) for i in range(0, len(data), 2)) return result...
(1) odpowiedzi
2016-11-26 16:11 Python bruteforcer using selenium »
I want to create a python automated login script, so I can log into web pages by just running a script how would I go about making this using Selenium...
(0) odpowiedzi
2016-11-26 07:11 reading lines of a file between two words »
I have a file containing numbers and 2 words : "start" and "middle" I want to read numbers from "start" to "middle" in one array and numbers from "mid...
(4) odpowiedzi
2016-11-26 01:11 Are the subprocess/commands modules Unicode aware with Python2? »
Is the stdout/stderr captured from the various functions in the subprocess or the commands module for Python2 guaranteed to be a standard string, or i...
(1) odpowiedzi
2016-11-24 14:11 How to print with append, custom separator, and suppress trailing space in Python 2? »
I'm printing my output in a file with this command: print >> outfile, columns2[0],"\t",columns2[1],"\t",columns2[2] My problem is that I have...
(3) odpowiedzi
2016-11-23 21:11 Where is documentation for multiprocessing.pool.ApplyResult? »
There is frighteningly little strict API documentation (read: ZERO) for multiprocessing.pool.ApplyResult. The multiprocessing explanation doc talks ab...
(2) odpowiedzi
2016-11-23 19:11 str to unicode not working python »
I am trying to match the exact format of a response. I have: def recreate_metrics_format(self): MAP = { # "measurment_name": "measurement...
(0) odpowiedzi
2016-11-23 14:11 Python multiple replacement with matching »
Work in Progress Json2yaml converter for Ansible (http://docs.ansible.com/ansible/ec2_group_module.html) creation Link to Project: https://github.com...
(1) odpowiedzi
2016-11-21 21:11 Property in Python with @property.getter »
I have an intresting behaviour for the following code: class MyClass: def __init__(self): self.abc = 10 @property def age(self):...
(1) odpowiedzi
2016-11-21 18:11 Length of binary data in python »
I am using Python. I am trying to determine the correct length of bytes in a binary set of data. If I assign a variable the binary data... x = "aab...
(1) odpowiedzi
2016-11-20 04:11 Using multiple python version with jupyter »
I am using anaconda installers and have python2 installed. I however, do want to use both python 2 and 3 interchangeably in jupyter notebooks. I read ...
(0) odpowiedzi
2016-11-19 21:11 What is python list indexes explanation here? »
Here is part of my code: some_item = target_item first_item = my_list[0] print first_item print some_item print my_list.index(first_item) print my_li...
(1) odpowiedzi
2016-11-18 14:11 %s formatting precedes + operator in joining two strings before formatting »
Revived some old code and tried to refactor it to match Python7 and 3 standards. A lot of string operations used the "Something was %s in here" % "me...
(1) odpowiedzi
2016-11-17 16:11 What's the relationship between str and bytes in python? »
Consider the following typescript: >>> s = 'a' >>> isinstance(s, bytes) True >>> isinstance(s, str) True >>> isin...
(1) odpowiedzi
2016-11-16 11:11 DRF: JSONField in serializers with TextField in models cause stringification »
I am using python 2.7.11 A have a model let's say Game that has a TextField that's supposed to store json values. TextField was chosen because the da...
(0) odpowiedzi
2016-11-15 08:11 What was the rationale behind creating input() in Python 2? »
In Python 2, there were two ways of getting input. raw_input() and input(), which was a wrapper around eval(raw_input()). In Python 3 however, input()...
(2) odpowiedzi
2016-11-14 08:11 incorrect answer in beginner name program, Python »
name = raw_input("Insert Name: ") typedname = "Brock", "brock" name == typedname if name != "Brock" "brock": print "Access ...
(3) odpowiedzi
2016-11-07 20:11 Python mysql.connector: list tables in a database and fields in database »
An AWS database had a table with fields created via MySQL workbench. Python mysql.connector was installed on target platform: MySQL workbench indicat...
(0) odpowiedzi
2016-11-06 19:11 remove escape character from string »
I would like to turn this string: a = '\\a' into this one b = '\a' It doesn't seem like there is an obvious way to do this with replace? EDIT:...
(3) odpowiedzi
2016-11-05 02:11 Why this single quotes and braces in output in python? »
I am using ipython notebook in ubantu version 16.04 and I run this code, word = 'Rushiraj' length = 0 for char in 'rushiraj': length = length + 1...
(2) odpowiedzi
2016-11-04 23:11 How is True < 2 implemented? »
It's not implemented directly on bool. >>> True.__lt__(2) AttributeError: 'bool' object has no attribute '__lt__' And it's apparently not ...
(3) odpowiedzi
2016-11-04 20:11 Is this how adding a python list to numpy arrary is expected to work? »
Adding a python list to a numpy array produces the same result as adding a python float to a numpy array. If the array is cast as a list when it is ad...
(0) odpowiedzi
2016-11-04 14:11 How to get the Unicode representation of Arabic strings in Django? »
I'm wondering how to get the Unicode representation of Arabic strings like سلام in Python? The result should be \u0633\u0644\u0627\u0645 I need ...
(4) odpowiedzi
2016-11-01 21:11 Unicode to String Python 2 »
I am trying to convert an plain string into the special character to work it in my logic in python 2. word = 'Tb\u03b1' word = unicode('Tb\u03b1') i...
(1) odpowiedzi
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