text
stringlengths
226
34.5k
Python module won't install Question: This is my `setup.py` file #!/usr/bin/env python from setuptools import setup from sys import path setup(name= 'conundrum', version= '0.1.0', author= 'elssar', author_email= 'elssar@altrawcode.com', py_modules= ['...
SyntaxError in Python handler Question: I am using urlfetch available from Google App Engine to fetch URLs content. But I am getting 500 Internal Server Error. Here is the complete app code that I am using :- **compare-hatke.py** import urllib2 from google.appengine.api import urlfetch from goo...
How to parse XML hierarchies with python? Question: I'm new to python and have been taking on various projects to get up to speed. At the moment, I'm working on a routine that will read through the Code of Federal Regulations and for each paragraph, print the organizational hierarchy for that paragraph. For example, a ...
Django Error "Caught SyntaxError while rendering: invalid syntax " Question: I'm creating an django app via this tutorial <https://docs.djangoproject.com/en/dev/intro/tutorial04/> I'm trying to access admin page but it display this error which I don't know how to fix. TemplateSyntaxError at /admin/ C...
Python macro in regular expression Question: In the below case i have used `"|"` condition in matching multiple search patterns and replacing all the search patterns with the value. It worked fine. But Does python has any MACRO type of thing where i can write all the patterns in it and call that in the search pattern? ...
Pygame 'LEFT' is not defined Question: I'm working on a game. I have pygame imported. I am using Python 3.3 and Pygame 3.3. The same error message all the time "LEFT" is not defined. I did exact copies of what were on the internet as I already did a search for the problem. Here is my code. I have tried a few different ...
Date and Time string parse Question: I have a date time string formatted as follows: **2012-12-03T02:00:00Z** I want to split the date and time up and display it as follows: 03/12/2012 02:00:00 How can I do this in python in as few a lines as possible?? (The 'T' and 'Z' will be removed) Answer: This goes through t...
Python Flask, how to set 'Content-Type' for static files (js)? Question: For my Flask app I use 'windows-1251' encoding. To draw a template I set 'Content-Type' as follows: from flask.helpers import make_response def render_tmpl_dummy(): response = make_response("Some Russian text here")...
Can I create a subclass derived from metaclass like this? Question: I tried to create a class that inherit from a metaclass declared in the superclass, I did like that: from sqlalchemy import Column, String, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm...
Python Coin Toss Question: I am VERY new to Python and I have to create a game that simulates flipping a coin and ask the user to enter the number of times that a coin should be tossed. Based on that response the program has to choose a random number that is either 0 or 1 (and decide which represents “heads” and which ...
How to specify the dimensions of a Tkinter text box in pixels? Question: **Question** How would I specify the dimensions of a Tkinter text box using pixels? I am not trying to change the font size - I am using this to help me scale it to the size of the window. **Tech Specs** OS: Windows 7 Python 2.7.3 Answer: You...
python local scope Question: Running this code: import re regex = re.compile("hello") number = 0 def test(): if regex.match("hello"): number += 1 test() Produces this error: Traceback (most recent call last): File "test.py", line 12, in <modul...
C Code Link Errors with an iPhone App Question: I am having link errors when integrating a small number of C source files into an objective-c iOS project. The C files were given to me by another developer who successfully used the code in c projects and in python projects. When I add the c source code into the XCode ...
Run a Python Script from the Web Question: I've been stumbling along with the same problem for almost a year now. I always find a way to work around it, but I'm tired of finding work arounds. What I need is to create a button on a Web Page (preferable HTML, not PHP or ASP) that runs a python script on the server. I'd ...
Can't connect to JIRA Python through REST api https url Question: I try to connect to a jira dev sandbox through https but it comes up with an SSL23_GET_SERVER_HELLO:unknown protocol error This is the error log/stack trace. I try both ports 8080 and 443 but no joy. >>> from jira.client import JIRA ...
Getting a "TypeError: an integer is required" when trying to connect to MySQL Question: Total Python newb here. I'm following the tutorial from [this page](http://zetcode.com/db/mysqlpython/). But when I run my code I get the following error in the console. Traceback (most recent call last): File ...
Learn SQL The Hard way - Creating .sql with .db in SQL Lite 3 - Why and How? Question: As a beginning programmer with +20 hours of Python coding and novice familiarity with the command-line, I opened up Zed Shaw's "Learn SQL The Hard Way" and was quickly stumped. In [exercise 01](http://sql.learncodethehardway.org/boo...
Benchmarking with Python Question: I am looking to use Python as a system to benchmark other process's time, data I/O, correctness, etc. What I am really interested in is the accuracy of the time. For example start = time() subprocess.call('md5sum', somelist) end = time() print("%d s", end-st...
"Error generating the Discovery document for this api" when trying to build a drive service, starting 2/14/2013 Question: I am intermittently getting this error when calling build on a drive service. I am able to reproduce this with a simple program which has the JSON credentials stored to a file. #!/usr...
lxml on python-3.3.0 ImportError: undefined symbol: xmlBufContent Question: I am having a hard time installing lxml(3.1.0) on python-3.3.0. It installs without errors and I can see the lxml-3.1.0-py3.3-linux-i686.egg in the correct folder (/usr/local/lib/python3.3/site-packages/), but when I try to import etree, I get ...
Can you loop through pixels in an image without loading the whole image? Question: I have some very large images. I don't want to load the whole image into memory, I just want to make a single pass through the image in row order. Is it possible to do this in Python/scipy? EDIT: I'm using .PNG, but I could convert them...
Set Gtk.ComboBoxText default item? Question: I would like to make an item in my ComboBoxText the default value, instead of a blank combo box until the user selects something. Apparently, this is set by changing Active value in Glade to [the item I want to be default]. This does not work. Here is my code: ...
how to write setup.py for this application structure? Question: I have written an application with python (2.7). The structure looks like: kent$ tree myApp myApp |-- foo.py |-- gui | |-- g1.py | |-- g2.py | |-- g3.py | `-- __init__.py |-- icons | |-- a.png ...
Python Client-server problems Question: I am making a chat program. I have a (TCP) server which creates a new thread for every connection request it gets. 1. I'm having problems when the client quits/terminates connection. The server raises an error(below). How do I handle it? 2. And, the server has to send the '...
Django - how to collapse forms like in the django admin Question: I use [django-form-utils](http://pypi.python.org/pypi/django-form-utils) to generate BetterModelForm with fieldsets similar to the django admin. With BetterModelForm its possible to associate CSS with fieldset with the 'classes' option. I would like to k...
Python, tkinter: How to select a directory then load the path as a variable to an imported class? Question: I am developing a gui in which the user has to browse choose the a directory. Then I need the directory path to be saved as a variable and used by an imported class. So far I have written the code that enables a...
Loading huge XML files and dealing with MemoryError Question: I have a very large XML file (20GB to be exact, and yes, I need all of it). When I attempt to load the file, I receive this error: Python(23358) malloc: *** mmap(size=140736680968192) failed (error code=12) *** error: can't allocate region...
Setting process name (as seen by `ps`) in Go Question: The following (rightfully) doesn't work: package main import ( "os" "time" ) func main() { os.Args[0] = "custom name" println("sleeping") time.Sleep(1000 * time.Second)...
working with lynx in python terminal +displaying spanish characters not working Question: I am querying lynx browser with a URL and getting the output from the terminal, but the problem is the output is from a peruvian website and the spanish characters are not being displayed correctly on the terminal. I am passing th...
Histogram based probability density estimation Question: How do I make a histogram based probability density estimate of each of the marginal distributions p(x1 ) and p(x2 ) of this data set: import numpy as np import matplotlib.pyplot as plt linalg = np.linalg N = 100 mean = [1,1] ...
Date 6 months into the future Question: I am using the datetime Python module in django. I am looking to calculate the date if the expiry date is less than or equal to 6 months from the current date. The reason I want to generate a date 6 months from the current date is to set an alert that will highlight the field/co...
Django - Uncaught IndentationError while rendering Question: The error occurs in the following line of the template, and I couldn't manage to understand why? In template /usr/local/django/app/templates/main.html, error at line 51 <script type="text/javascript" src="{% url django.views.i18n.javas...
Convert string to list in python Question: I need to convert an string to a list in python, The string format is as follows, '[{"name":"Tom","adress":"adress1"},{"name":"Mari","adress":"adress2"}]' I need to convert this **string** in to python **list** data type and want to get the dictionaries by...
request.environ['HTTP_REFERER'] is None Question: i want to get `HTTP_REFERER` in python flask framework. My route is this: @app.route('/login') def login(): if authenticateForPanel(): return redirect(url_for("panel")) else: ref = reque...
Automake, GNU make, check, and (ignored) pattern rules Question: I have the following Makefile.am which is supposed to create `foo.hdb` and `foo.cdb` from `foo.h` (via the Python script): TESTS = check_foo check_PROGRAMS = check_foo check_foo_SOURCES = check_foo.c $(top_builddir)/src/is...
Equals not being equals Question: Can't get python quiz program to work, when the 'useranswer' is 'correctanswer' if loop doesn't work properly and states they aren't equal even when they are. I'm wondering if this is a problem with comparing strings saved in lists, but I am really stuck for what to do to fix it. Any h...
Searching a file with the contents of another file python Question: I have a file that has a unique ID number on each line. I am trying to search a different file for the occurrences of these ID numbers and return the line where these id numbers are in the second file, in this case into an output file. I am new to prog...
Python: two questions about a "numpy.ndarray" Question: I created a numpy.ndarray with value import numpy as np from numpy import nonzero data = np.zeros((5, 5)) data array([[ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0...
How to disable Google App Engine python SDK import hook? Question: I am playing around with local deployment of GAE python SDK. The code that I am trying to run contains many external libraries which are not part of GAE import whitelist. I want to disable the import restrictions and let GAE app import any locally insta...
Python: copying a repeating dictionary into a list - last dict item being duped to all list items Question: Considering the following: import re sequence = 'FFFFFF{7}FFFFFF' patterns = [ ('([0-9a-fA-F]+)', 'Sequence'), ('(\\([0-9a-fA-F]+\\|[0-9a-fA-F]+\\))', 'Option'), ('({[0-9a-f...
Convert unicode string dictionary into dictionary in python Question: I have unicode `u"{'code1':1,'code2':1}"` and I want it in dictionary format. I want it in `{'code1':1,'code2':1}` format. I tried `unicodedata.normalize('NFKD', my_data).encode('ascii','ignore')` but it returns string not dictionary. Can anyone h...
methods inheritance in python Question: class Field(object): def __init__(self): self.drunks = {} def addDrunk(self, drunk, loc): if drunk in self.drunks: raise ValueError('Duplicate drunk') else: self.drunks[drunk] = loc...
FastCGI Dynamic Server Config. for Django/Apache Question: I'm trying to run Django 1.4 with Pyton 2.7, Flup and mod_fastcgi on Apache. So what I did was: 1. Add mod_fastcgi to httpd.conf 2. Create two files : .htaccess and index.fcgi in my public web root inside a directory called portal - `c:\xampp\htdocs\portal...
Developing behave steps with PyDev Question: [Behave](http://pythonhosted.org/behave/) is a great tool for behavior driven development in Python. However, in combination with PyDev I've got two Problems: 1. PyDev can't resolve behave's `@given`, `@when` and `@then` annotations. This probably happens because behave d...
Using sockets with wxpython Question: I have a TCP server and a TCP client. I want to make a GUI version of the code below, using [wxpython](/questions/tagged/wxpython "show questions tagged 'wxpython'"). I have the GUI interface script ready, but, I am having problems merging the two scripts. How do I merge my so...
How can I read /etc/config.d/... with python? Question: I want distros to pick up my python app so they can make a /etc/myapp config file and a /etc/myapp.d/ folder, where users can put their configs over overwrite settings in /etc/myapp. It should support the following (more or less standard) configuration style. ...
Python While Loop CPU demanding Question: I don't want to bother people here with a simple question and also tell that I googled for information but I would like to get input from the people who as faced the same. It is stated that while loops in python slow down (<http://wiki.python.org/moin/WhileLoop>). I have a scri...
Is there a Python equivalent to HighLine? Question: [HighLine](http://highline.rubyforge.org) is a Ruby library for easing console input and output. It provides methods that lets you request input and validate it. Is there something that provides functionality similar to it in Python? To show what HighLine does see th...
Mayavi: interpolate face colors in triangular_mesh Question: I have pieced together the following code to plot a triangular mesh with the colors specified by an additional scalar function: #! /usr/bin/env python import numpy as np from mayavi import mlab # Create cone n = 8 t = n...
Python - make script loop until condition met and use a different proxy address for each loop Question: I'm the definition of a noob. I know next to nothing about python and am looking for help. I can read just enough code to alter variables to suit my wants/needs but I when it comes to doing something the original cod...
Japanese Numerals to Arabic Numerals converter in Python Question: Is there an open source library in Python which does Kanji Numeral to Arabic Numeral conversion/translation? Input : 10億2千9百万 Output: 1,029,000,000 Input : 1億6,717万2,600 Output: 167,172,600 Input : 3,139百万 Output: 3,139,000,000 Japanese Numera...
SQLAlchemy & PassLib Question: _**tl;dr -- How do I use a Python-side library such as PassLib to hash passwords before inserting them into a MySQL DB with SQLAlchemy?_** Alright, so I've been banging my head on my desk for a day or two trying to figure this out, so here it goes: I am writing a web application using P...
python how to keep one thread executing till other threading finished Question: I hope to record app(eg.com.clov4r.android.nil) the CPU occupancy when I operate the app(eg.doing monkey test) and finish recording when I eixt the app(eg.finishing monkey test). How to realise it with python? Some codes: pa...
Missing text in GUI (PyGObject) Question: I have created a GUI with pyGObject using a xml description file and I'm trying to create a sidebar with `GtkTreeView`. `GtkTreeView` doesn't show _any_ text in the headers and children in my GUI even though I have added some. Why is that? How can I fix it? The sidebar should ...
Storing an encrypted password to mysql in python Question: import sys import hashlib import getpass from passlib.hash import sha256_crypt import MySQLdb, random, os def SQLAddPass(username, password): SQL = 'insert into user values ("%s", "%s")' % (username, password) ...
Python threads, thread is not informed to stop Question: I would like to stop a Python thread when the main program stops. It is for a class that connects to a server. The connection is maintained by the background thread, the foreground thread answers to callbacks. The following is a minimal example. #!...
How to dynamically replace contents of HTML tags with Python on Google App Engine with lxml? Question: I am using Google app engine and python to build an application. I am incredibly new to python as well as GAE. I have a index.html file with the basic template for my site. However I would like to replace the contents...
Installing Setuptools with root - Getting a PythonPath error Question: I already did the virtual python enviroment. When I'm trying to install setuptools I get the following: python setup.py install --prefix=/home/dgomez/ Error: TEST FAILED: /home/dgomez//lib/python2.7/site-packages...
pymongo operation error Question: I am getting a lot of records from my MongoDB and along the way I get an error File "C:\database\models\mongodb.py", line 228, in __iter__ for result in self.results: File "C:\Python27\Lib\site-packages\pymongo\cursor.py", line 814, in next if len(s...
python: change sys.stdout print to custom print function Question: Im trying to understand how to create a custom print function. (using python 2.7) import sys class CustomPrint(): def __init__(self): self.old_stdout=sys.stdout #save stdout def write(self, text): ...
How to stop Python from checking for files upon execution Question: I've got a script I've put together that generates a number of files full of json data by calling another python module. I then want to be able to import those after they are generated and do things with the data they contain. The problem is, when I t...
Django, TemplateDoesNotExist error: Heroku can't find template directory. How to show it where to look? Question: I've done much clicking and syncdb'ing and have yet to find a solution. I get this error: TemplateDoesNotExist at /quotes/ quotes/index.html Request Method: GET Request URL: ht...
Python/CGI/Ajax: cgi.FieldStorage does not receive arguments Question: I am trying to get a Python, cgi module, ajax/javascript combination to work. Due to the nature of my server access (essentially rented webspace), I cannot install things like django or any other webframework. I am stuck with cgi for now. I am able ...
python and statement Question: import random def main(): number = random.randint(0,100) print(number) guess = int(input("Enter your guess: ")) if guess == number : print("You win $10,000!") elif guess // 10 == number // 10 or guess % 10 == numb...
How to make a 4d plot with matplotlib using arbitrary data Question: This question is related to this [one](http://stackoverflow.com/questions/7855229/how-to-make-a-4d-plot-using- python-with-matplotlib). What I would like to know is how to apply the suggested solution to a bunch of data (4 columns), e.g.: ...
output operand requires a reduction, but reduction is not enabled Python Question: import numpy as np from numpy.linalg import solve,norm,cond,inv,pinv import math import matplotlib.pyplot as plt from scipy.linalg import toeplitz from numpy.random import rand c = np.zeros(512) c[0]...
Error in python griddata: "builtins.IndexError: index 0 is out of bounds for axis 0 with size 0" Question: ## Griddata error (adapted from: [Matplotlib contour from xyz data: griddata invalid index](http://stackoverflow.com/questions/13781025/matplotlib-contour-from- xyz-data-griddata-invalid-index)) I have a matrix ...
How to achieve pagination with results from a list in web.py python Question: I am using python `web.py` to design a small web app , here actually i am not using any database for fetching results/records, i will have a list of records(which i will get from some where according to requirement :) ) Below is my code **c...
Connecting to a protected WiFi from Python on Linux Question: I'm creating a software for Ubuntu Linux that needs to connect to a WiFi AP. The WiFi network is not predefined and can change several times during a single run of the software (the user is the one who orders the change). The idea is this: given a set of SSI...
Way to read first few lines for pandas dataframe Question: Is there a built-in way to use `read_csv` to read only the first `n` lines of a file without knowing the length of the lines ahead of time? I have a large file that takes a long time to read, and occasionally only want to use the first, say, 20 lines to get a s...
pylab troubles with EPD version of ipython Question: I recently switched to the EPD version of ipython (I have the 64-bit student edition), and now I'm having trouble with pylab. When I type "import pylab" it gives me the following error ImportError Traceback (most recent ca...
How can I interact with an application on mac through python subprocess? Question: I know there are similar questions posted already, but non of the methods I have seen seems to work. I want to launch the application xfoil, on mac, with python subprocess, and send xfoil a bunch of commands with a script (xfoil is an ap...
Is it possible to replace schema locations in Suds/python? Question: I'm trying to hit a WCF service that's being hosted behind a reverse proxy/redirect. The WCF service is reporting the wrong `schemaLocation`, based on which machine it's actually being served from. For instance, I get something like this: ...
Why is there no xrange function in Python3? Question: Recently I started using Python3 and it's lack of xrange hurts. Simple example: **1)** Python2: from time import time as t def count(): st = t() [x for x in xrange(10000000) if x%4 == 0] et = t() print et-st count() ...
Python, how to send output to both file and terminal Question: I want to use Python to send output to both a file `log.txt` and STDOUT on the terminal. Here is what I have: import sys class Logger(object): def __init__(self, filename="Default.log"): self.terminal = sys.stdout ...
How to Construct JSON string django view? Question: I want to construct json like this in the `django` view: { "Skills": [ { "Name": "Java", "Value": "Java" }, { "Name": "J2ee", "Value": "J2ee" ...
How are import statements in plpython handled? Question: I have a plypython function which does some json magic. For this it obviously imports the json library. Is the import called on every call to the function? Are there any performance implication I have to be aware of? Answer: The `import` is executed on every f...
Keyboards event on coco2d (python) and pyglet Question: second question here, my first one was answer and really helped, so I'll try again. Here is the code and the explanation: import cocos from cocos.actions import * import pyglet from pyglet.window import key from pyglet.window.key im...
Unwrapping t.co link that links to bit.ly Question: I'm trying to get the URL that has been already shortened by bit.ly and again by twitter. I have already tried: import urllib.request r = urllib.request.urlopen(url) r.url Also by using libraries such as [requests](http://docs.python- requ...
JPype won't compile properly Question: So I am having trouble compiling a very simple python script using [JPype](http://jpype.sourceforge.net/). My code goes like: from jpype import * startJVM(getDefaultJVMPath(), "-ea") java.lang.System.out.println("hello world") shutdownJVM() and wh...
Python Program is Terminating on Handled Exception Question: I am editing the question for clarity. I created a class in a module that imports MySQLdb. I have found that MySQLdb will raise an Exception if the table the user passes to my class does not exist. I am catching that exception, and passing a new one to the c...
Cannot set up Google App Engine for Python 2.7 on OSX 10.6 Question: Trying to run the Python 2.7 dev environment for Google App Engine on Mac OSX (10.6.8), but I cannot get the helloworld example won't run. I cannot import webapp2 in a Python shell. When I try to run from the GUI, the log reports that my "Python comm...
Parsing out single column from csv into text file using python Question: I finally got my dbf file to be a csv but now I am confused as to how to parse this out into a text file for further editing. I have been reading up on the csv module but to be honest my head began to spin. So much of it seemed Greek to me. Howev...
Flask-Mail breaks Celery Question: I've got a Flask app where celery works fine and Flask-Mail on its own works fine as well. from celery import Celery from flask_mail import Mail, Message app = Flask(__name__) mail = Mail(app) celery = Celery('main_app', broker...
If RAM isn't a concern, is reading line by line faster or reading everything into RAM and access it? - Python Question: If RAM isn't a concern (I have close to 200GB on the server), is reading line by line faster or reading everything into RAM and access it? Each line will be a string of around 200-500 unicode characte...
How to continuously display python output in a webpage? Question: I want to be able to visit a webpage and it will run a python function and display the progress in the webpage. So when you visit the webpage you can see the output of the script as if you ran it from the command line and see the output in the command l...
Hebrew calendar in python Question: I have to work with Jewish Calendar in Python. I want to know if there is a Jewish Calendar in Python or if there is import in python Hope for answers Answer: You could use [the Python Date Utilities module](http://sourceforge.net/projects/pythondateutil/), which claims to convert...
ImportError: No module named prop2part (TuLiP) Question: Using TuLiP module in Python, an error message always appears when I try to compile a code I have : `ImportError: No module named prop2part` In the code, initialization contains : import sys, os import matplotlib as mpl import matplotlib....
Weird behavior in Python Question: I wrote a simple program to translate DNA to RNA. Basically, you input a string, it separates the string into characters and sends them to a list, shifts the letter and returns a string from the resulting list. This program correctly translates a to u, and to to a, but does not change...
Python and RFC 3339 timestamps Question: Where can I find a routine for building an RFC 3339 time? Answer: This was based on the examples on page 10 of the RFC. The only difference is that I am showing a microseconds value of six digits, conformant to Google Drive's timestamps. from math import floor ...
PyQt4 nested classes - "RuntimeError: underlying C/C++ object has been deleted" Question: I'm trying to build a cool app, but it seems I lack some knowledge. Read lots of infos and examples in internet, but it doesn't help: [Understanding the "underlying C/C++ object has been deleted" error](http://stackoverflow.com/qu...
Python - sort wrt second argument Question: I have a list, which I wish to sort. List is made of items with two elements each. I wish to sort wrt to second element only. Thus, I am almost sure that L = [[4,2],[5,2]] sorted(L) won't do the job. How to proceed? I come through answers but did not...
Python - how to check system load? Question: I am writing a script to check if the given urls are proper and resolve an IP. I'd like to fasten things up so I decided to put it into multiple threads. However, I want to make sure that the scripts does not overload the server it runs on. The question is: how can I check s...
Using python modules in node.js Question: Is it possible to create a glue that makes it possible for python modules (more specifically, library bindings) to be used in node.js? Some of the data structures can be directly mapped to V8 objects - e.g. array, dict. More importantly - would that be a more elegant way to cr...
Embedded python module import errors Question: Here's a simplest of simple python interpreter in C. What I want to is to use .py files as a scripting language for engine hardcoded in C - running this code (with python27.dll/lib) runs fine on machine with python. #pragma comment(lib,"python27.lib") #i...
Scipy map_coordinates bilinear interpolation compared to interp and IDL interpolate Question: I'm in the process of rewriting a coworkers IDL code into python and am coming up with some differences that I'm confused about. According to other SO questions and mailing list threads I've found if you use `scipy.ndimage.int...
How to run a python script with options Question: I'm looking for an efficient way to write a python script that can be called using the hyphen-single-letter-space-parameter convention (e.g. `python script.py -f /filename -t type -n 27`, where `f`, `t`, and `n` are the single letters corresponding to option types and `...
Are there Python code for Scalar Multiplication, Dot Product, Norm (length) without using external library, function? Question: Here vectors are used as Python tuples. Like the vector `[3;1;1]` is represented in Python as `(3,2,1)`. 1. Write a Python function sca(s,v) that takes 2 arguments: Scalar s and vector v. T...
Read .net pajek file using python igraph library Question: I am trying to load a .net file using python igraph library. Here is the sample code: import igraph g = igraph.read("s.net",format="pajek") But when I tried to run this script I got the following errors: Traceback (most r...
python: select a sublist with a list length limit Question: > players = [ a long list of (id, float) tuples with each id unique, order by > highest float] > > on_teams = [ a list of unique ids, every on_teams id is also in the players > list] picked = set(on_teams) best_remaining = [] for best_pla...