-8

I have one challenge to complete!

I have one form that takes the email typed, like this: (Always in this format) example: bianca.mary@john.com

I need to get the first part (bianca) before '.' and put this in one label and in another label, put the second part (mary)

Could you help me?

Bianca C.
  • 111
  • 1
  • 4
    share your code first, what you have tried so far – ggupta Aug 10 '17 at 11:45
  • Use string `split`. This looks like a homework question, so I'll just point you in the right direction: https://stackoverflow.com/questions/743806/how-to-split-a-string-into-a-list – kenny_k Aug 10 '17 at 12:03

1 Answers1

1
dotPoint = text.index(".")
atPoint = text.index("@")
firstPart = text[0:dotPoint]
secondPart = text[dotPoint+1:atPoint]
print firstPart
print secondPart

This will output

bianca
mary

There you go. On Python 2.7 :)

buddhiv
  • 692
  • 1
  • 7
  • 24