1 defines a String object str
. 1 str.title () # string separated by a space with the first letter capitalized character segments 2 str.rstrip () # spaces with the end of the string omitted . 3 str.strip () # spaces with the first string end of the deleted to 4 str.lstrip () # will be the first of a string of spaces deleting
2 dir (object): print out all of the member objects, including functions
3 import this: python print of Zen
4 defines a list object bicycles = [ 'trek', 'cannondale', 'redline', 'specialized']
. 1 bicycles.append ( ' STR ' ) # end of the list to add members 2 the sorted (Bicycles) # the elements of a list according to lexicographic order . 3 bicycles.sort () # list of members carrying sort method . 4 bicycles.reverse () # the list of members of the order reversed
5 in keyword
' Trek ' in bicycles # The members of the bicycles in the true and false otherwise
5 define a dictionary object user = { 'username': 'efermi', 'first': 'enrico', 'last': 'fermi'}
. 1 user.items () # Returns a list of dictionary type 2 EG: dict_items ([( ' username ' , ' efermi ' ), ( ' First ' , ' Enrico ' ), ( ' Last ' , ' Fermi ' )]) . 3 user.values () # returns the value of a type of dictionary list . 4 EG: dict_values ([ ' efermi ' , ' Enrico ' , ' Fermi ' ]) . 5 User.key () Similarly