'\n\t\r \f ') and b.split (b ') to achieve the same purpose3) both zip (), map (), and filter () return iterators. and apply (), callable (), coerce (), execfile (), reduce (), and reload() function has been removed.You can now replace callable () with Hasattr (). Hasattr () syntax such as: hasattr (String, ' __name__ ')4) String.letters and related. Lowercase and. Uppercase are removed, use string.ascii_letters, etc.5) If x 6) __GETSLICE__ series members were discarded. A[I:J] is converted fro
methodObject () automatically executes the __call__ method in the classExample:classA:def __init__(self):Pass deffunc (self):Print(111) def __call__(Self, *args, * *Kwargs):" "various Codes" " #print (666) Print(args)return 'Wusir'A1=A ()Print(A1 ())__eq__ methodWhen comparing the two objects instantiated by a class, he automatically triggers the __eq__ in the class.class A: def __init__ (self): = 1 = 2 def__eq__(self,obj): if and self.b = = ob
follows:1nums=[1,2,3,4,5,6,2,3,4,6,4,3,2,1,2,3,4]2 Print(Nums[3:6])#[4,5,6]3 Print(Nums[:6])#[1,2,3,4,5,6] If the previous value of the slice is not written, the number from the beginning4 Print(nums[3:])#[4,5,6,2,3,4,6,4,3,2,1,2,3,4] If the subsequent value of the slice is not written, take the end5 Print(nums[:])#if the two values of a slice are not written, take it from the beginning to the end6 Print(Nums[::2])#step is 2, this represents all the elements, and then every 2 elements take a7 P
a comma {x,} means that the preceding content appears x or more times, and two numbers separated by commas {x, y} indicate that the preceding content appears at least x times, but not more than y times. We can extend the pattern to more words or numbers: ^[a-za-z0-9_]{1,}$//All strings that contain more than one letter, number, or underscore ^[1-9][0-9]{0,}$//all positive integers ^\-{0,1}[0-9]{1,}$ All integers ^[-]? [0-9]+\.? [0-9]+$//all floating-point numbers The last example is not ve
Data type, ListFunction:Create: Empty List A = [] Non-empty List A = [' Alex ', ' Jack ', ' Ella ', ' mark '] b = a.copy ()Query: Finds an element by index, the index is found by an element,Slices: Default Gu Tou regardless of tailAdded: Append insertDelete: Clear del removeLoops: ForSort by: SortLoop names list, print the index value of each element, and the element, when the index value is even, change the corresponding element to 1names = ["Old_dri
(Basic Python tutorial) learning notes | chapter 03rd | string
Chapter 2: Using strings
------
Supported operations
Index slices add elements to delete elements update element search elements (check whether an element is a member of a sequence) sequence length maximum value minimum other built-in functions
>>> Website = 'HTTP: // www.python.org '>>> website [-3:] = 'com' # this operation is invalid bec
One. String:(i) operation of a single element in a string1. Sequence combinations of single characters (elements).2. Sequence: The position of a single character3. Sequence operation: Built-in function len gets length, plus position index4. Get the elements in the string: Forward index + Reverse Index(ii) Manipulation of multiple elements in a string: shards1. X[i:j]: Remove the X from the offset of I, until but not including the element with an offset of J.2. In one Shard, the left boundary def
default paragraphs!BR is line breakA label1. Target property, _black means open on new page2. AnchorH label H1h2h3h4h5h6select labelShanghaiBeijingGuangzhouShanghaiBeijingGuangzhouGuangzhou ShanghaiBeijingGuangzhouGuangzhouShijiazhuangHandan TaiyuanPingyaoCheckboxRedio MaleWomanConfidentialManWomanConfidentialPasswordbuttonFileWhen submitting a file: Enctype= ' multipart/form-data ' method= ' POST 'TextAreaLabel name:Marriage No:Name: Marriage No:UL ol DLUl
Ul.li
Ul.li
Ul.li
1. Manually traverse the iteratorUse the next function and captureStopIteration异常。def Manual_iter (): With open ('./test.py') as F: try : while True: = Next (f) print line except stopiteration: PassThe next function can also specify a value to mark the end def Manual_iter (): With open ( " ./test.py ) as F: try : while true:line /span>= Next (f, None) if line ==
, the 100,000th character of Unicode has been adopted and recognized as one of the criteria), a set of code diagrams that can be used as a visual reference, a set of encoding methods and a set of standard character encodings, a set containing superscript words, Enumeration of character attributes such as subscript characters. The Unicode organization (the Unicode Consortium) is operated by a non-profit organization and dominates the subsequent development of Unicode, with the goal of replacing t
First, the opening of the large section of poisonous chicken soup is really enough to fill. Just outside the tour, all the time with headphones on the whole hearing.Second, enter the subject, the results are introduced. Next version problem, try to use Python3.Third, Hello world. It's a ceremonial feeling, nothing else.Print ("Hello")Iv. variables. Although the hump rule is OK, but Python is recommended to use _ underline, that is underlined. Variable
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.