Steven's answer is probably a lot more robust, but I would use a simple
split.
mylist = ['hypothetical protein BRAFLDRAFT_208408 [Branchiostoma
floridae]\n', 'hypoxia-inducible factor 1-alpha [Mus musculus]\n',
'hypoxia-inducible factor 1-alpha [Gallus gallus]\n' ]
for item in mylist:
item.spl
Thank you all for the suggestions! I decided to use Steven's re loop in the
end.
Joel, what i meant earlier was that the link you sent seems to suggest me
to replace some characters in the list and I'm not sure how it would work...
On Sun, Dec 29, 2013 at 9:24 PM, Joel Goldstick wrote:
>
>
>
Hah,I must understand,I read it that way!
>
> Oops, sorry a typo crept into this. That last line ought to be
> "return g(23)". Sorry for any confusion.
>
>
>
> --
> Steven
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription
This is all really quite awesome, though I'm sure it'll be a while before
these are really available tools for me. I think I get(a bit more than) the
basic concept. Thanks!
> is a short-cut for this:
>
> def spam(n):
> return "spam"*n
>
> spam = decorator(spam)
>
>
> This may be a lot to diges
Wow Steven, this is great.I'll be brief I'm on a phone
> def f(x):
> print("Inside the outer function x =", x)
> def g(y): # a function nested inside another function
> print("Inside the inner function x =", x)
> print("Inside the inner function y =", y)
> return x
On Sun, Dec 29, 2013 at 9:00 PM, Jing Ai wrote:
> Thanks, but I don't think I can get out the string in the brackets by only
> replacing other items...(there's too many things to replace and may
> interfere with the items within the string).
>
>
>
I am not sure what you mean by your previous sen
On Sun, Dec 29, 2013 at 04:02:01PM -0500, Jing Ai wrote:
> Hello,
>
> I am trying to rewrite some contents on a long list that contains words
> within brackets and outside brackets and I'm having trouble extracting the
> words within brackets, especially since I have to add the append function
> f
On Sun, Dec 29, 2013 at 4:02 PM, Jing Ai wrote:
> Hello,
>
> I am trying to rewrite some contents on a long list that contains words
> within brackets and outside brackets and I'm having trouble extracting the
> words within brackets, especially since I have to add the append function
> for list
Hello,
I am trying to rewrite some contents on a long list that contains words
within brackets and outside brackets and I'm having trouble extracting the
words within brackets, especially since I have to add the append function
for list as well. Does anyone have any suggestions? Thank you!
*An e
On Sun, Dec 29, 2013 at 5:58 PM, Steven D'Aprano wrote:
> If you want to test for something that a human reader will recognise as
> a "whole number", s.isdigit() is probably the best one to use.
isdigit() includes decimal digits plus other characters that have a digit value:
>>> print u'\N{s
On Mon, Dec 30, 2013 at 09:58:10AM +1100, Steven D'Aprano wrote:
> What gives you that impression? isspace works on Unicode strings too.
>
> py> ' x'.isspace()
> False
> py> ''.isspace()
> True
Oops, the above was copied and pasted from Python 3, which is why there
are no u' prefixes. But
On Sun, Dec 29, 2013 at 02:36:32PM +0100, Ulrich Goebel wrote:
> Hallo,
>
> I have a unicode string s, for example u"abc", u"äöü", u"123" or
> something else, and I have to find out wether
>
> 1. s is not empty and contains only digits (as in u"123", but not in
> u"3.1415")
>
> or
>
> 2. s is
Quoting "Tobias M." :
Quoting Lolo Lolo :
Hi Tobias can i just ask. As i already have Python 3.3, when i
install this separate version of 3.3, will there be a conflict on
the command line when i type python3.3? This install i want just
for virtualenvs but i wonder if it would replace my
Quoting Lolo Lolo :
Hi Tobias can i just ask. As i already have Python 3.3, when i
install this separate version of 3.3, will there be a conflict on
the command line when i type python3.3? This install i want just for
virtualenvs but i wonder if it would replace my other 3.3 as the
defa
On Sun, 29 Dec 2013 19:20:04 +, Mark Lawrence
wrote:
> 2. s is empty or contains only whitespaces
Call strip() on it. If it's now empty, it was whitespace.
--
DaveA
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription o
On 29/12/2013 13:36, Ulrich Goebel wrote:
Hallo,
I have a unicode string s, for example u"abc", u"äöü", u"123" or
something else, and I have to find out wether
1. s is not empty and contains only digits (as in u"123", but not in
u"3.1415")
or
2. s is empty or contains only whitespaces
For al
Hallo,
I have a unicode string s, for example u"abc", u"äöü", u"123" or
something else, and I have to find out wether
1. s is not empty and contains only digits (as in u"123", but not in
u"3.1415")
or
2. s is empty or contains only whitespaces
For all other cases I would assume a "normal"
On Wed, Dec 25, 2013 at 2:16 AM, Tobias M. wrote:
> ./configure --prefix=
>
> where is a custom path (e.g. in your home directory) where you want
> to install python. You can configure without the --prefix option, but if you
> just want to use this python installation for virtuelenvs I would ins
On Sun, Dec 29, 2013 at 10:33:15PM +1100, Steven D'Aprano wrote:
> def f(x):
> print("Inside the outer function x =", x)
> def g(y): # a function nested inside another function
> print("Inside the inner function x =", x)
> print("Inside the inner function y =", y)
>
Last one!
On Sun, Dec 29, 2013 at 01:57:31AM -0500, Keith Winston wrote:
> In the previous timer function that I was using, it defined a timer class,
> and then I had to instantiate it before I could use it, and then it saved a
> list of timing results. I think in yours, it adds attributes to eac
On Sun, Dec 29, 2013 at 01:57:31AM -0500, Keith Winston wrote:
> Also: in the timer function, it has a series of attribute assignments to
> 0/None after the inner function definition... from the behaviour, I assume
> those are applied once, the first time the timer function is called
> wrapping a
On Sun, Dec 29, 2013 at 01:57:31AM -0500, Keith Winston wrote:
> I don't really get the inner thing, I tried to look it up, but I don't
> think I found the right thing, just references to nested functions. I'd
> like to understand what I'm looking at better, but can't figure out what
> question to
22 matches
Mail list logo