Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
issue in email slicer
#2
Well, the problem with the second loop is that it will only work for the character immediately after the "@". There are two better and easier ways to do this.

  1. string = "[email protected]"
    split = string.find("@")
    print("User:", string[:split])
    print("Host:", string[split:])
  2. string = "[email protected]"
    split = string.split("@")
    print("User:", split[0])
    print("Host:", split[1])
Reply


Messages In This Thread
issue in email slicer - by spalisetty06 - Jun-29-2020, 12:52 PM
RE: issue in email slicer - by stullis - Jun-29-2020, 04:40 PM
RE: issue in email slicer - by spalisetty06 - Jun-30-2020, 09:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  An email with inline jpg cannot be read by all email clients fpiraneo 4 4,000 Feb-25-2018, 07:17 PM
Last Post: fpiraneo
  Email - Send email using Windows Live Mail cyberzen 2 5,936 Apr-13-2017, 03:14 AM
Last Post: cyberzen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020