"Etrade Griffiths" <[EMAIL PROTECTED]> wrote > > I want to check the type of a variable so that I know which format > to use > for printing eg
That's sometimes necessary but you may find that just using %s will suffice. print "%s\n" % 42 print "%s\n" % "42" print "%s\n" % 42.0 You usually only need to check the type if the format string includes type specific precision and justification characters. but the %s format will work for most types most of the time. > The comparison type(a) == 'int' etc does not work type(a) == type(1) HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor