07-numpy string operations

AS NP numpy Import 
Print (np.char.add ([ "Hello"], [ "Baby"])) # [ 'hellobaby'] 
Print (np.char.add ([ "Hello", "A"], [ "Baby", "B"])) # [ 'hellobaby' 'AB'] 
Print (np.char.multiply ( "nimei",. 3)) # plurality of strings into a single string superimposed 
print (np.char. center ( "*", 20, fillchar = "_")) # string filled 
print (np.char.capitalize ( "nimei") ) # returns to the beginning string uppercase 
print (np.char.title ( "nimeititle, hao are you ")) # the beginning of each capitalized 
Print (np.char.lower (" ABC ")) 
Print (np.char.upper (" abc ")) 
Print (np.char.splitlines (" HELLP \ the n-123 213 ")) cut in rows # 
print (np.char.split (" hellp \ n 123213 ", sep =" \ n ")) # press sep cut 
print (np.char.strip (" AAA ")) # Remove trailing spaces 
print (np.char.str_len ( "ABCD E" )) # seek length 
print (np.char.join ( ":", "ABC")) # splicing each letter: 
Print (NP. char.join ( ":", [ " ABC", "EFG"])) # splicing each letter of each string:
print (np.char.join ([ ":" , "@"], [ "ABC, EFG"])) # corresponding to splice 
print (np.char.replace ( "hello A" , "A", "B" )) # A replaced B 
Print (np.char.encode ( "prosperity", "utf-8") ) # coding 
print (np.char.decode (b '\ xe5 \ xaf \ x8c \ xe5 \ xbc \ xba ', "utf-8") ) # decodes

  

Guess you like

Origin www.cnblogs.com/wcyMiracle/p/12423413.html