AttributeError

Denis McMahon denismfmcmahon at gmail.com
Thu Aug 13 13:06:20 CEST 2015


On Thu, 13 Aug 2015 02:41:55 -0700, Ltc Hotspot wrote:

>>> How do I define X?

> What are the values of X & Y from the code as follows:

> # print time: ['From', 'stephen.marquard at uct.ac.za', 'Sat', 'Jan', '5', 
'09:14:16', '2008']

This is the data you need to look at.

X is the position in the printed list of the time information. If you can 
not determine the correct X value by inspection of the list having been 
told which element it should be, then you need to go back to the python 
documentation and read about the list data object and how elements within 
the list are referenced. Once you understand from the documentation how 
to reference the list elements, you will be able to determine by 
inspection of the above list the correct value for X.

Y is the position of the hours element within the time information when 
that information is further split using the ':' separator. You may need 
to refer to the documentation for the split() method of the string data 
object. Once you understand from the documentation how the string.split() 
function creates a list, and how to reference the list elements (as 
above), you will be able to determine by inspection the correct value for 
Y.

This is fundamental python knowledge, and you must discover it in the 
documentation and understand it. You will then be able to determine the 
correct values for X and Y.

Note that the code I posted may need the addition of a line something 
like:

    if line.startswith("From "):

in a relevant position, as well as additional indenting to take account 
of that addition.

-- 
Denis McMahon, denismfmcmahon at gmail.com


More information about the Python-list mailing list