lanah_ Posted March 8, 2009 at 05:04 AM Report Share #249059 Posted March 8, 2009 at 05:04 AM Tem como eu dividir uma string em partes? Por exemplo string_qualquer = 'ATCGUTBNA' string_dividido = ['ATC', 'GUT', 'BNA'] Link to comment Share on other sites More sharing options...
Triton Posted March 8, 2009 at 11:49 AM Report Share #249084 Posted March 8, 2009 at 11:49 AM Se o objectivo for dividir uma string de 3 em 3: >>> a = [] >>> s ="ABCDEFGHJI" >>> for i in range(0,len(s),3): ... a.append(s[i:i+3]) ... >>> a ['ABC', 'DEF', 'GHJ', 'I'] <3 life Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now