[EMAIL PROTECTED] wrote: > For example i write the following code in the Python command line; > >>>> list = ['One,Two,Three,Four'] > > Then enter this command, which will then return the following; > > ['One,Two,Three,Four'] > > > Now the problem, reading through the Python tutorial's, it describe's > that list's can sliced, concatenated and so on etc > > So i write the following > >>>> list[1:] + ['Five'] > > Then the error returned is that 'str' and 'list' could not be > concatenated which is where it baffles me. I'm understanding that this > mean's that the string 'Five' could not be joined onto the list, as i > havn't defined it in the array. Viewing the Python tutrial they have > the following, and working code; > >>>> a[:2] + ['bacon', 2*2] > ['spam', 'eggs', 'bacon', 4] > > How can they have the string 'bacon' and have it returned with no > error? > Your error message doesn't match your command. Now if you typed:
list[0]+['Five'] that gives you the error you showed. What you meant to type was: l = ['One','Two','Three','Four'] This is a list of four strings, what you entered was a list of one string. NOTE never call a variable 'list' as it will mask the built-in list method (same goes for str, tuple, int, float, etc). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list