Jun-09-2018, 12:22 PM
Hi,
this exercise in the Py4E course should print: 21, 31, uct.ac.za.
When I run the program (python3 filename), my results are: 21, -1, uct.ac.za Sat Jan 5 09:14:16 2008.
Can someone tell me why is this happening?
Thanks.
this exercise in the Py4E course should print: 21, 31, uct.ac.za.
When I run the program (python3 filename), my results are: 21, -1, uct.ac.za Sat Jan 5 09:14:16 2008.
Can someone tell me why is this happening?
Thanks.
data = 'From [email protected] Sat Jan 5 09:14:16 2008' atpos = data.find('@') # the atpos variable will have the position of the @ sign print (atpos) spos = data.find(' ',atpos) # look for a space starting from the position of the @ sign print (spos) host = data[atpos+1 : spos] print (host)