[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-670918-105":59,"doc-detail-670918-en":130,"doc-similar-670918":161},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","the-python-cheat-sheet-quick-reference","The Python Cheat Sheet - Quick Reference","","A compact Python cheat sheet covering core language concepts and everyday syntax needed for web backends, data work, automation, and scripting. It explains dynamic typing, indentation-based blocks, variables and common types, strings with key methods, numeric and math operators, and standard conversions and built-ins. It also summarizes lists, tuples, dictionaries, sets, branching, loops, functions with defaults and variadic arguments, file handling, exceptions, modules and imports, and practical mini-recipes with pip/venv setup guidance, plus key style pitfalls to avoid.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/the-python-cheat-sheet-quick-reference/670918/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/the-python-cheat-sheet-quick-reference/670918.png","ImageObject",300,407,{"name":92,"@type":93},"eBook King","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-09","2026-11-01",true,{"@type":102,"interactionType":103,"userInteractionCount":29},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"How does Python define code blocks and what are common indentation rules?","Question",{"text":112,"@type":113},"Python uses indentation of four spaces to define code blocks. Avoid mixing tabs and spaces to prevent IndentationError.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What are the differences between /, //, and % in Python?",{"text":117,"@type":113},"Single-slash / always returns a float division result. Use // for floor division and % for the remainder.",{"name":119,"@type":110,"acceptedAnswer":120},"How do you safely read and write files in Python?",{"text":121,"@type":113},"Use a with open(...) block so files close automatically. Open in modes like r (read), w (overwrite), or a (append), then read or write via f.read, f.readlines, or f.write.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},670918,1793572702,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":29,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":29,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143,"preview_page_count":19,"preview_urls":144},962088006270,"https://ap-avatar.wpscdn.com/davatar_085a072bc5b1113ac321206ff7593b45","The Python Cheat Sheet  \nThe Python Cheat Sheet · [WebsiteSetup.org](WebsiteSetup.org)  \n\n| What is Python |\n| --- |\n| Python is a readable, general-purpose language for web backends, data, automation, and scripting. The current stable release is 3.13, and 3.14 is the newest in 2026. Run it with  python3 . Indentation of four spaces deﬁnes code blocks, not braces.\u003Cbr>Variables and data types |\n\nPython uses dynamic typing. Assign a value and the type is inferred.  \n\n| Example | Type | Meaning |\n| --- | --- | --- |\n| x = 5 | int | Whole number |\n| pi = 3 .14 | ﬂoat | Decimal number |\n| name = \"Ada \" | str | Text |\n| ok = T rue | bool | True or False |\n| z = None | NoneType | No value |\n\nCheck with  type (x ) . Build text with f-strings:  f \"Hi { name} , x= {x } \" .  \nStrings  \nString methods return new strings and never change the original.  \n\n| Operation | Result |\n| --- | --- |\n| len ( s ) | Character count |\n| s [ 1:4] | Slice from index 1 up to 4 |\n| s . upper ( ) / s . lower ( ) | Change case |\n| s . strip ( ) | Trim whitespace |\n| s . split ( \" , \" ) | Split into a list |\n| \" , \" . join ( list ) | Join a list into text |\n| s . replace ( \"a \" , \" b \" ) | Swap substrings |\n| \" b \" in s | Membership test |\n\nNumbers and math  \nSingle-slash division always returns a ﬂoat, so  7 / 2 == 3 .5 .  \n\n| Operator | Meaning | Example |\n| --- | --- | --- |\n| + - * / | Basic arithmetic | 7 / 2 == 3 .5 |\n| // | Floor division | 7 // 2 == 3 |\n| % | Remainder | 7 % 2 == 1 |\n| ** | Power | 2 ** 3 == 8 |\n\nAlso:  int ( ) ,  float ( ) ,  round (x , 2 ) ,  abs ( ) , and  import math  for  math . sq rt ( ) and  math . pi .  \nLists ( mutable)  \n\n| Lists hold an ordered, changeable sequence. |  |  |\n| --- | --- | --- |\n| xs = [ 1 , 2 , 3 ]\u003Cbr>xs .append ( 4 )\u003Cbr>xs . insert ( 0 , 9 )\u003Cbr>xs . remove ( 2 ) last = xs . pop ( ) part = xs [ 1:3] xs . sort ( ) new = sorted (xs ) doubled = [x * 2 | \\# add to end\u003Cbr>\\# add at index 0\u003Cbr>\\# remove first match\u003Cbr>\\# remove and return last\u003Cbr>\\# slice\u003Cbr>\\# in place , returns None\u003Cbr>\\# returns a new list for x in xs if x > 1 ] |  |\n| Tuples ( immutable) |  |  |\n| Fixed groups of values that cannot change. |  |  |\n| t = ( 1 , 2 )\u003Cbr>a , b = t \\# unpacking |  |  |\n| Dictionaries |  |  |\n| Key-to-value maps with fast lookups by name. |  |  |\n| d = { \"a \" : 1 , \" b \" : 2 } d [ \"a \" ]\u003Cbr>d .get ( \" z \" , 0 )\u003Cbr>d . keys ( ) ; d .values ( ) ;\"a \" in d\u003Cbr>sq = { k : v * 2 for k , |  | \\# 1\u003Cbr>\\# safe default\u003Cbr>d . items ( )\u003Cbr>\\# membership\u003Cbr>v in d . items ( ) } |\n| Sets |  |  |\n\nUnordered collections of unique values.  \ns = { 1 , 2 , 3 }  \ns .add ( 4 )  \na = { 1 , 2 , 3 } ; b = { 3 , 4 , 5 }  \na | b \\# union  \na & b \\# intersection  \na - b \\# difference  \nBranch on truth. Four-space indentation groups each block.  \nif x > 10 :  \nprint ( \" big \" ) elif x > 0 :  \nprint ( \" small \" ) else:  \nprint ( \" zero or less \" )  \ny = \" hi \" if x else \" lo \" \\# ternary  \nPattern matching (Python 3.10 and later):  \nmatch command :  \ncase \" start \" :  \nprint ( \" starting \" ) case   :  \nprint ( \" unknown \" )  \nLoops  \n\n| Walk sequences with  for ; helpers cover the common cases. |\n| --- |\n| for i in range ( 3 ) : \\# 0 , 1 , 2\u003Cbr>print ( i )\u003Cbr>for i , v in enumerate (xs ) : \\# index and value print ( i , v )\u003Cbr>for a , b in zip (xs , ys ) : \\# pai r two lists print ( a , b )\u003Cbr>while count \u003C 5 :\u003Cbr>count += 1\u003Cbr>if count == 3 :\u003Cbr>continue\u003Cbr>if count == 4 :\u003Cbr>break |\n| Functions |\n\nReusable logic with defaults, variadic args, and type hints.  \ndef greet ( name: st r , loud : boo l = False ) -> st r: text = f \"Hi { name} \"  \nreturn text . upper ( ) if loud else text  \ndef total (*args , **kwargs ) : return sum ( args )  \nsq = lambda x: x * x  \nBuild a new collection in one line.  \nsquares = [x * x for x in range ( 5 ) ] lookup = {x: x * x for x in range ( 5 ) } unique = {x % 3 for x in range ( 10) }  \n\\# list  \n\\# dict  \n\\# set  \nFiles  \n\n| The  with  block closes ﬁles automatically. |\n| --- |\n| with open ( \" f .txt \" , \" r \" )","cbCaiiPEaEvvk0C5","https://ap.wps.com/l/cbCaiiPEaEvvk0C5","pdf",159326,"English","# What is Python\n## Variables and data types\n## Strings\n## Numbers and math\n## Lists, tuples, dictionaries, sets\n## Branching, loops, functions\n## Files and exceptions\n## Modules, imports, built-ins\n## pip/venv and mini-recipes","[{\"question\":\"How does Python define code blocks and what are common indentation rules?\",\"answer\":\"Python uses indentation of four spaces to define code blocks. Avoid mixing tabs and spaces to prevent IndentationError.\"},{\"question\":\"What are the differences between /, //, and % in Python?\",\"answer\":\"Single-slash / always returns a float division result. Use // for floor division and % for the remainder.\"},{\"question\":\"How do you safely read and write files in Python?\",\"answer\":\"Use a with open(...) block so files close automatically. Open in modes like r (read), w (overwrite), or a (append), then read or write via f.read, f.readlines, or f.write.\"}]","The Python Cheat Sheet - Quick Reference | PDF",15,[145,149,153,157],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/d1b49ba56769913f38be3e4332538294.webp",983,1391,{"page_no":14,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/cc61b2172f6301070cdd353597c6b8fe.webp",982,1389,{"page_no":81,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/36f386782d0473bac8dd493191c468ce.webp",981,1388,{"page_no":19,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/dc0ed8b33327bb7aff85fb499f4c4e70.webp",980,1387,{"list":162,"token":66},[163,169,175,181,188,194,200,206,212,218],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":24,"category_name":30,"create_tm":168},685635,"Lists, Tuples and Dictionaries - Lecture 10","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000169926/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=OIJa2ZmjSxPpz0f8ilUXEgfh0dY%3D","lists-tuples-and-dictionaries-lecture-10",1794016103,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":81,"category_name":30,"create_tm":174},685777,"Lists and Tuples - Learn to create and use 1D lists, tuples and 2D lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203949/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=Q567A6l9djmtSX4b6Q3vvmeUHFY%3D","lists-and-tuples-learn-to-create-and-use-1d-lists-tuples-and-2d-lists",1794018226,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":34,"category_name":30,"create_tm":180},685771,"Compound Data - Lists, Tuples, Dictionaries - Unit IV - Learning Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203726/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=jumpzko6zAQfaWcOKaCtvUrdyuY%3D","compound-data-lists-tuples-dictionaries-unit-iv-learning-notes",1794018217,{"doc_id":182,"doc_title":183,"file_type":137,"home_preview_img_url":184,"slug":185,"view_count":186,"category_name":30,"create_tm":187},671794,"Python Tutorial - Release 3.7.0","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988403939/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=LzftnMzPV9l2s7oaPtZPegtYIB8%3D","python-tutorial-release-370",16,1793580648,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":81,"category_name":30,"create_tm":193},697975,"Python Variable Types - Variable Assignment, Multiple Assignment, and Standard Data Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146715/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=OlYtJhHL%2BaOWK93Zp9ccEgxA84M%3D","python-variable-types-variable-assignment-multiple-assignment-and-standard-data-types",1794446554,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":143,"category_name":30,"create_tm":199},417799,"PYTHON PROGRAMMING - R17A0554 - Lecture Notes - B.TECH III YEAR II SEM","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922495571/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=KtrCfKz3WazA5H6zloGJKSUoAVk%3D","python-programming-r17a0554-lecture-notes-btech-iii-year-ii-sem",1790610657,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":24,"category_name":30,"create_tm":205},692235,"Learning Python - Fourth Edition - Learn Python Programming","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003011256/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=RsCUFd6Ah2y4T6RhDWGO%2FzuUUZU%3D","learning-python-fourth-edition-learn-python-programming",1794186387,{"doc_id":207,"doc_title":208,"file_type":137,"home_preview_img_url":209,"slug":210,"view_count":34,"category_name":30,"create_tm":211},670917,"Python 3 Cheat Sheet - concise reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988704071/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=JSEZF0pTXr5DxbNIl1H1OIbBEI4%3D","python-3-cheat-sheet-concise-reference",1793572698,{"doc_id":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":29,"category_name":30,"create_tm":217},697978,"Lecture 4: Tuples, List Slicing, List Comprehension, Strings","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146771/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=Wvz6zlSWxDmO1VACn%2BvUBKF8%2B44%3D","lecture-4-tuples-list-slicing-list-comprehension-strings",1794446559,{"doc_id":219,"doc_title":220,"file_type":137,"home_preview_img_url":221,"slug":222,"view_count":14,"category_name":30,"create_tm":223},721612,"Complete JavaScript - Professional Tips and Tricks","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230025022643/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=QLdeyuLm3tpMQf4RCBVULakQ3HI%3D","complete-javascript-professional-tips-and-tricks",1795060939]