Questions for python


6425

python: how to import * and call imported functions when package is directory not file

if I'm developing a client-server app and have 3 files client.py, server.py, and common.py, and common.py has a useful function "normalize()", it's easy from both client and server to "from common ...
9802

How to know if python script was run using interpreter's -m option?

I couldn't find answer after having read all the following:
6068

Single precision big endian float values to Python's float (double precision, big endian)

I need to receive hex encoded single precision big endian float values coming from an Arduino over a serial line (RS-232). How do convert them to Python's float which are big endians with double
4891

Trouble setting Python version in Sublime Text2

I'm having trouble setting the build environment in Sublime Text2.
5458

Newly added record in datastore is not refelcting in the application

I have been facing this problem in app engine. As I am new to App Engine, I don't know whether I am doing it right way or not.
4093

how to add/subtract 2 days in the target day in python?

I have a problem in adding or subtracting 2 days to the target day...
7635

three argument filtering

Lets assume I have defined function:
3041

Python Login Script

I know similar questions have been asked, I have read them. I have also read most other related articles I could find. I have tried httplib2, header modifications, and anything else I could find or...
5610

MX Record lookup and check

I need to create a tool that will check a domains live mx records against what should be expected (we have had issues with some of our staff fiddling with them and causing all incoming mail to redi...
9790

Passing a variable to a method in a class

I'm new to using classes and I'm trying to pass a variable to one of the methods inside of my class. How do I do it?
6481

Scraping multiple pages for parsing in Beautiful Soup

I'm trying to scrape multiple pages off of a single website for BeautifulSoup to parse. So far, I've tried using urllib2 to do this, but have been encountering some problems. What I've attempted is:
3748

pip giving “ImportError: No module named setuptools” but I can import setuptools in python interpreter

I'm getting setup on a new mac and I was humming along just fine, installing pip and a few packages. When suddenly, every pip command I'd try to run would throw
9569

Problem with Arduino and pySerial

I got a problem. I recently bought an Arduino Uno board. I tried to make something funny like controlling an input from my computer. I used Python with pySerial and the program is the following:
8925

Decoding unicode from Javascript in Python & Django

On a website I have the word pluČ™ sent via POST to a Django view.
9587

python USER_BASE error

I am using python 2.6 and trying to install django tagging package and i get this error below.I am installing few python 2.4 packages on a 64 bit machine which already has python2.6.
9493

Test computer processing speed with a simple Python script

I want to make a simple script just to test the time that the computer takes to execute it.
3889

Count frequency of letters in a text file

In python, how can I iterate through a text file and count the number of occurrences of each letter? I realise I could just use a 'for x in file' statement to go through it and then set up 26 or so...
5738

Jinja 2 safe keyword

I have a little problem understanding what an expression like {{ something.render() | safe }} does .
4672

Storing items in a DynamoDB table where the key and range key may overlap

I'm looking to store a large collection of photos in a DynamoDB table.
6696

Is it possible to set the implicit OneToOne key directly when using multi table inheritance in Django?

I'm trying to extend a library model through multi-table inheritance and this is what I ended up with:
7666

Django + fcgi = new edits to views.py not shown

I wanted to dive into Python\Django development and used what I had at hands:
8461

Windows opens .py file with C:\Python27\Python.exe despite rebinding Python.File

I followed Python's official FAQ to make .py file executable, i.e. adding .py to $PATHEXT and bind Python.File to "C:\Python27\Python.exe" "%1" %*. The result was fine:
2683

Random Forest interpretation in scikit-learn

I am using scikit-learn's Random Forest Regressor to fit a random forest regressor on a dataset. Is it possible to interpret the output in a format where I can then implement the model fit without ...
2003

python module import question

So I have a big project with many modules in it, and I want to run some profiling on it. I have a profile module that basically just provides a decorator that I can add to a function to profile it ...
4909

How to get started with Big Data Analysis

I've been a long time user of R and have recently started working with Python. Using conventional RDBMS systems for data warehousing, and R/Python for number-crunching, I feel the need now to get my
4796

How do I catch/except registration errors with Django?

I want to be able to return a message to the user when they try to register but their registration fails.
814

predict the outcome numbers using a list

I have 3 lists with 3 sets of integers. I want to predict the outcome numbers using a list or by whatever other means is out there.
4622

Edgelines vanish in mplot3d surf when facecolors are specified

I have produced the following surface plot in matlab:
8495

Setting up Python and Virtualenv on OS X 10.8.1?

I recently reinstalled my OS X and my python setup is gone with it. I can't remember how I set it up before and now I am having a lot of trouble. I followed this guide
1718

How do I do a case insensitive string comparison in Python?

What's the best way to do case insensitive string comparison in Python?
8940

Add sub-elements to newly created elements in python elementtree

I am trying to add the following subtree to an element 'Drugs' in an xml file using elementtree in Python based on the data in CSV file:
4253

ElementTree and unicode

I have this char in an xml file:
7206

String format a json String gives KeyError

Why does this code give a KeyError?
410

Python - Backslash Quoting in String Literals

I have a string that contains both double-quotes and backslashes that I want to set to a variable in Python. However, whenever I try to set it, the quotes or slashes are either removed or escaped. ...
2437

Cleaning Python modules an have fresh start Mac OS X

I am not a total newbie but I am trying to install modules for quite a long time and at this point i would like to have a fresh start and install python and all the modules I need so i really under...
5663

Python dictionary keys besides strings and integers?

Anyone have some neat examples of dictionaries with some interesting keys (besides the canonical string or integer), and how you used these in your program?
7486

Python 2.7, OS portable way to determine permissions / contents of a puser entered path

Disclaimer: i have searched genericly (Google) and here for some information on this topic, but most of the answers are either very old, or don't seem to quite make sense to me, so I appologize in
5208

Tkinter Display varLabel and value cleanly

I've am new to Tkinter and have written a program to open a file and parse binary messages.
2393

Passing List Values as Parameters

list = ['12345','23456']
1985

What do I use on linux to make a python program executable

I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.
5343

Python - get UTC offset by seconds

Based on this code, how do I get the UTC offset of a given date by seconds. get UTC offset from time zone name in python
7455

Fast cross correlation method in Python

I have been recently trying to find a fast and efficient way to perform cross correlation check between two arrays using Python language. After some reading, I found these two options:
541

Packaging a Python library

I have a few Munin plugins which report stats from an Autonomy database. They all use a small library which scrapes the XML status output for the relevant numbers.
6620

How do I make PIL take into account the shortest side when creating a thumbnail?

Currently, for my function below...the image will be resized based on the longest side.
3327

how do django forms work

I am learning Django. Particularly I am reading about forms and I cannot understand how do they work.
2031

Matplotlib histograms (basic questions)

I am trying to plot a simple histogram using matplotlib. I have for example (I will in practice be using different distance functions)
7277

Combine all elements of two arrays python

I have two arrays, and want to combine the ith elements in each one together:
6822

Read a file, skip unwanted lines & add into a List

I have the following code where I scan every line and put in a list. If the line matches

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.