Hi,
I am having some trouble with a piece of code below:
Input: li is a nested list as below:
li = [['>0123456789 mouse gene 1\n', 'ATGTTGGGTT/CTTAGTTG\n', 'ATGGGGTTCCT/A\n'], ['>9876543210 mouse gene 2\n', 'ATTTGGTTTCCT\n', 'ATTCAATTTTAAGGGGGGGG\n']]
Using the function below, my desired output is simply the 2nd to the 9th digits ...
In Python, I need a dictionary object which looks like:
{'a': 10, 'b': 20, 'c': 10, 'd': 10, 'e': 20}
I've been able to get this successfully by combining the dict.update() and dict.fromkeys() functions like so:
myDict = {}
myDict.update(dict.fromkeys(['a', 'b', 'c'], 10))
myDict.update(dict.fromkeys(['b', 'e'], 20))
However, bec...
Hello,
Does anyone know of a python string-to-float parser that can cope with MSVC nan numbers (1.#QNAN)? Currently I'm just using float(str) which at least copes with "nan".
I'm using a python script to read the output of a C++ program (runs under linux/mac/win platforms) and the script barfs up when reading these values. (I did alread...
Hello, I have a bunch of Objects from the same Class in Python.
I've decided to put each object in a different file since it's
easier to manage them (If I plan to add more objects or edit them individually)
However, I'm not sure how to run through all of them, they are in another Package
So if I look at Netbeans I have TopLevel... an...
Hi folks,
A simple question, perhaps, but I can't quite phrase my Google query to find the answer here. I've had the habit of making copies of objects when I pass them into object constructors, like so:
...
def __init__(self, name):
self._name = name[:]
...
However, when I ran the following test code, it appears to not be necessa...
I keep hearing all this hype about Twisted for python, but i just find it plain confusing. What do you think is more simple to use? Simple sockets or implementing twisted ?
...
i've a small user defined function in python, say fib(n), how do i use that in other programs or modules?
def fib(n):
should i use import or is there any other feature?
Also i'm learning python in eclipse IDE, it wont support
print "any string"
but i'm forced to use like,
print("string")
in python manual online, its given its cr...
How do i install package and libraries of facebook api? When i use
import facebook, there's error?
I see only svn checkouts, some files are empty, how do i download and get them working?
...
I have Python script bgservice.py and I want it to run all the time, because it is part of the web service I build. How can I make it run continuously even after I logout SSH?
...
I need a regular expression and a way to extract email address from a html page.
code sample needs to be in python
...
Using win32com, I have two workbooks open.
How do you know which one is active?
How do you change which one is active?
How can you close one and not the other? (not Application.Quit())
...
I'm finishing a certain django project. It's a data entry application with more than 170 tables in a postgresql database. The application would primarily serve to support a large data entry operation that would last about 2 months. After that it would only serve to export the entered data as xml and json. Plus people may use just the dat...
In my stackless application I'd like to have Erlang style message box queues. Instead of mandating that sending tasklets are blocked until the receiving tasklet is ready to receive, I'd like to have the sending tasklet to queue up the message in the receiver's message box, and be able to wake the receiver if it's sleeping.
The sending t...
I need to be able to offer "downloadable" events for Outlook, via vCalendar objects - if I'm not mistaken.
From the research I've done, I've been pointed at using vObject. I've looked at their usage examples, but having no prior experience with the format, it's not clear to me how to solve my problem, as I'm not sure what fields are av...
Hi everyone,
I have a Logitech G15 keyboard. It has a screen. Can i program this? I googled it but the one site i found didn't work.. It seems like it is possible, but i cannot grasp how.
Thanks!
This site is truly great.
...
I'm embedding Python into a C++ application. I plan to use PyEval_EvalCode to execute Python code, but instead of providing the locals and globals as dictionaries, I'm looking for a way to have my program resolve symbol references dynamically.
For example, let's say my Python code consists of the following expression:
bear + lion * ...
this may not be an earth-shattering deficiency of python, but i still
wonder about the rationale behind the following behavior: when i
run
source = """
print( 'helo' )
if __name__ == '__main__':
print( 'yeah!' )
#"""
print( compile( source, '<whatever>', 'exec' ) )
i get ::
File "<whatever>", line 6
#
^
SyntaxError: inv...
Hello guys,
I am sending a SOAP request to my server and getting the response back. sample of the response string is shown below:
<?xml version = '1.0' ?>
<env:Envelope xmlns:env=http:////www.w3.org/2003/05/soap-envelop
.
..
..
<env:Body>
<epas:get-all-config-resp xmlns:epas="urn:organization:epas:soap"> ^M
...
...
<epas:property ...
I'm tying to create a class that holds a reference to another classes method. I want to be able to call the method. It is basically a way to do callbacks.
My code works until I try to access a class var. When I run the code below, I get the error What am I doing wrong?
Brian
import logging
class yRunMethod(object):
"""
...
I was recently in a Software Engineering class that involved a semester-long group project. We were given requirements and were asked to build a piece of software to assist in a task. In our case, a Psychology professor wanted something to help her students track their sleep patterns.
My group pretty successfully used DJango to create a...