Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to make a regexp that matches this:
ORIGIN atcgt --(a dna sequence varying in length)-- //
But my skills aren't that good
You can use this pattern ^[ATCGU]+$
import re
dnpattern = re.compile("^[ATCGU]+$")
print dnpattern.match("ATC").group()
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm doing a Computer Science Lab with Python.
I've tried using some functions like s.insert (hot day, warm morning) but this doesn't help me add the value to the middle of the list. Can someone please help me out?
Thanks
Do this using insert
s.insert(index_to_insert, value)
For example:
s.insert(1, "hello") will insert the string "hello" as the second element of the list (since indexing starts at 0)
The problem is that you have s as a string not a list. You must convert to list then do the insertion as follows:
s = s.split()
s.insert(1, "warm")
s = ' '.join(s)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can i generate all possible polynomials for coefficients of 1..10 and a degree of 10 ?
preferably in Python or ruby .
I have found PythonPoly module , but still dont understand how to make it .
Thanks .
Seems like you want somebody to do your homework for you .
But here you go ...
my_polynomials = itertools.product(range(1, 11), repeat=10)
Then :
for p in my_polynomials:
do_something_with_polynomial(p)
This is a Ruby versioin
my_polynomials = (1..10).to_a.repeated_combination(10)
To print the first 50:
my_polynomials.take(50).each{|mp| p mp}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What is the regular expression that accepts all the words start with Alphabet only and reject all words having any occurrence of less than or more than three consecutive forward slashes (///) [if and only if slashes exist].
Example:
ABC2123_987 is allowed.
AV23DS///KOLJH is allowed.
But, the word FDG56/HJU is not allowed.
Also, FDG56////HJU is not allowed.
This matches any string beginning with an alphabetic, and containing zero slashes or exactly three consecutive slashes.
^[A-Za-z][^/]*(///[^/]*)?$
Try the pattern
re.compile('(\w+(///)?)*')
A better pattern, as seen in the comments for this answer:
re.compile('^[a-zA-Z]\w*?(///)?(\w+(///)?)*$')
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to create in Python a regular expression that matches words that contains A-Za-z or A-Za-z0-9, but not only 0-9.
For example I want to match fooT, foo23, fo24ooo, fo4o444, but NOT 40.
Is it possible?
One way would be:
r'\w*[A-Za-z]\w*'
\w matches _ as well as 'A-Za-z0-9' - if that's wrong, write out the whole class:
r'[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*'
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am having issues selecting all of the bindpose nodes in a scene.
How can I get them?
I am using PyMEL for this particular script.
use
pm.ls( type = 'dagPose')
to get all of the pose nodes in the scene. Then loop through those and check the .bindpose attribute to see if the pose node is a dag pose.
all_poses = pm.ls(type = 'dagPose') or []
bind_poses = [k for k in all_poses if k.bindPose.get()]