6 answers

Reformatting a list of lists by index within a loop, to reformat strings

I have a list of lists that looks like this, that was pulled in from a poorly formatted csv file: DF = [['Customer Number: 001 '], ['Notes: Bought a ton of stuff and was easy to deal with'], ...

6 answers | 18 secs ago by Matt O'Brien on Stack Overflow stackoverflow.com
1 answer

Reading only certain parts of a file and counting the number of elements

here is the file that I want to read off of. (cube.obj) #cube v 0.0 0.0 0.0 v 1.0 0.0 0.0 v 1.0 0.0 1.0 v 0.0 0.0 1.0 v 0.0 1.0 1.0 v 0.0 1.0 0.0 v 1.0 1.0 0.0 v 1.0 1.0 1.0 f 1 2 3 4 f 6 7 8 5 f 2 ...

1 answers | 50 secs ago by zakels on Stack Overflow stackoverflow.com
1 answer

How to convert a string with unicode in it to unicode using python

I am importing a bunch of data from excel using xlrd on python I get all my data in string like this : text:u'L\xc9GENDE' I manipulate these data and I try to put them back in excel (using ...

1 answers | 3 mins ago by user3724234 on Stack Overflow stackoverflow.com
0 answers

How to eliminate numbers that do not have different scrambled combinations within the range in Python

Prompt is Given integers A and B with the same number of digits and no leading zeroes, how many distinct scrambled pairs (i, j) are there that satisfy: A <= i < j <= B? For instance, if we ...

0 answers

Why am I not getting a Boolean?

>>> 'a' in 'aeiou' or 'steve' True >>> 'S' in 'Sam' and 'Steve' 'Steve' >>> 'a' in 'aeiou' and 'steve' 'steve' >>> 's' in 'aeiou' or 'AEIOU' 'AEIOU' I was working ...

4 answers

How to add two odd lists into one list in python?

I am very new to Python, and I'm trying to combine elements from two lists and produce a string from the combination. My variables are: fro = ['USD'] to = ['AUD', 'CAD', 'EUR'] I want output like ...

0 answers

Python Squaring Numbers from Text File

I am having issues trying to square numbers in a text file. The text file I have has the following: 2 8 4 3 7 14 12 9 This is my code so far: def squares(nums): answer = [] for i in ...

0 answers

OSError in Python?

first time on here. I'm currently hitting a snafu with an assignment. I'm writing a function to check for annotations but I'm getting an issue with when I'm comparing values. So for ex. I'm using ...

0 answers

Issue with pyCURL and RestAPI

I've went over several links on this site but don't recall all, will provide the one's I recall below... I am needing to setup a script to get data from an API in JSON format and posting back ...

2 answers

GC content in DNA sequence (Rosaland): how to improve my code?

Below is my code for a Rosalind question to calculate GC content without using Biopython. Can anyone give me some suggestions how to improve it? For example, I cannot include the last sequence in the ...

2 answers | 10 mins ago by ziweiguan on Stack Overflow stackoverflow.com
1 answer

Python script to read a line that has white space and return value

I need to read the line which has the const keyword and return version as the value. Content in the Version.php file final class Version { /** * The current Piwik version. * @var ...

1 answers | 12 mins ago by pricy on Stack Overflow stackoverflow.com
0 answers

create per network namespace socket connection

I am running some application in multiple network namespace. And I need to create socket connection to the loopback address + a specific port in each of the name space. Note that the "specific port" ...

0 answers

Scope of an instance variable in Python

I have a issue with a instance variable in Python, I need that variable is updated according as run program flow and this don't it , the variable FO in my function chiCuadrado return a void array, but ...

0 answers

Downloading File in Synchronous Fashion using Python

In the code below, I have a subprocess execute some shell scripts. While those shell scripts are executing, time is wasted not downloading the next file. # /usr/bin/python timenow = ...

0 answers

Questions about Python 'yield' keyword that I have not found answers elsewhere, and its specific use in a code I am working on

I am facing a python script that was handed over to me that works. I understand the purpose of that script and its role in the big picture of how it interacts with other modules, as well as its ...

0 answers

Editing objects in a list?

I'm making a program that keeps track of a number of things for a number of people, but I'm having an issue. My code looks like this: johnny_appleseed = ["", 1] def add_hour(name, hours): ...

0 answers

How to read a file in text online and copy the file in subprocess python

So, I have a text file which is like the one we are typing online in, in stackoverflow. I need to copy the contents of this, which is in java script, using subprocess python to a file, say "filename". ...

1 answer

Pandas Python - convert HH:MM:SS into seconds in aggegate (csv file)

I'm trying to convert the numbers in 'Avg. Session Duration'(HH:MM:SS) column into whole numbers (in seconds) in Pandas, read_csv module/function. for instance, '0:03:26' would be 216 seconds after ...

1 answers | 19 mins ago by Yumi on Stack Overflow stackoverflow.com
0 answers

No module named CFFI from FFI

I am very new to python . I insatlled scrapy and it installed properly but when I want to run it using scrapy command it says "No module named CFFI from FFI" any help please? Thanks in advance

2 answers

benchmarking bottle and flask - what is wrong?

I am attempting to benchmark flask and bottle to make some new project decision. I am seeing bottle fail miserably while flask seems to work. I cannot believe that the frameworks are so far apart ...

0 answers

How to create multiple connections to one host with elasticsearch-py?

I just found out that elasticsearch-py(1.2.0) only created one connection for each host you specifed. As you can see in the source code, connections are created with mapping over hosts: connections ...

1 answer

Comprehensive list of Python protocols/interfaces

Lately, I was looking at some Python idioms. I found many descriptions of protocols used in Python, such as the ordering (__cmp__, ...) or generators. Besides, there are also methods like __hash__ ...

1 answers | 23 mins ago by Kru on Stack Overflow stackoverflow.com
1 answer

Swig Python not wrapping methods

I am attempting to wrap with SWIG a c file that has a long list of user defined include "*.h" files. Looking at the swig complied *.py file all methods contained in certain *.h files seemed to be ...

1 answers | 23 mins ago by tobook on Stack Overflow stackoverflow.com
0 answers

Django 1.6: Displaying two models in template using SingleObjectMixin & ListView

Working on an application were I have a Many to One relationship where I have many Products and a few particular products will be related to only one Brand. In my Detail View I have the logic set to ...

6 answers

add vs update in set operations in python

What is the difference between add and update operations in python if i just want to add a single value to the set. a = set() a.update([1]) #works a.add(1) #works a.update([1,2])#works ...

6 answers | 27 mins ago by aceminer on Stack Overflow stackoverflow.com
3 answers

Python String Formatting - float with given precision AND padded by zeros

I have looked at a couple of dozen similar questions - and I'm happy to just get a link to another answer - but I want to zero pad a floating point number in python 3.3 n = 2.02 print( ...

1 answer

database postgresql doesn't create table

I try to launch my flask application with postgresql But got the error thats seems like it couldn't create table I think I do all the configuration correct But Now Just Got this error I try to use ...

1 answer

Linked List, 'int' object has no atrribute '_____'

I'm currently testing out my Linked List's functions, as of now I'm trying to do my getCount and getIndex functions. Every time I try to test it I get this error. C:\Python33\python.exe ...

1 answers | 31 mins ago by Cooper on Stack Overflow stackoverflow.com
2 answers

Statistics of region of numpy array

I have an array that measures about 2000 elements long, and I would like to figure out the standard deviation of it centered at each pixel by sliding a make-believe window of some relatively small ...

2 answers | 35 mins ago by DathosPachy on Stack Overflow stackoverflow.com
0 answers

Why is the window and contents stretched when using pygame for python?

So im a bit new to pygame and i was wondering why the pygame window and everything on it was stretched down slightly. It does not seem to be a code error because even when i define a window as ...

15 30 50 per page
1 2 3