Sunday 4 January 2015

Difference between Split and Partition in python


Return Type

  • Split returns a list, where as Partition returns a tuple.
Size

  • The size of list returned by a Split functions depends on the seperator and the max split size which is again optional
  • The size of tuple returned by a partition is fixed and is always 3

Arguments

  • Split can work without any arguments, which by default takes spaces and '\n' as default seperator
  • For Partition an argument is compulsory, else returns an error

No comments:

Post a Comment