{"id":882,"date":"2022-10-30T17:05:00","date_gmt":"2022-10-30T11:35:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=882"},"modified":"2023-08-15T16:02:11","modified_gmt":"2023-08-15T10:32:11","slug":"one-liners-in-python","status":"publish","type":"post","link":"https:\/\/geekpython.in\/one-liners-in-python","title":{"rendered":"Python One-Liners To Enhance Code Quality"},"content":{"rendered":"\n<p>Python is known for its simplicity and readability. Python provides flexibility to write complex code straightforwardly, and writing code in Python is like writing the English language.<\/p>\n\n\n\n<p>Python is popular because of its self-explanatory syntax and power to restrict long programs to a few lines. One-liners are one of the powers Python has, allowing users to write a single-line code that runs multiple tasks simultaneously.<\/p>\n\n\n\n<p>This article will show some one-line Python programs that help us in everyday programming, enhance productivity, and speed up our coding process.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-list-comprehension\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-list-comprehension\"><\/a>List Comprehension<\/h1>\n\n\n\n<p>We can use list comprehension for writing a multiline set of Python statements in a single line. We can write the&nbsp;<code>for<\/code>&nbsp;loop with an&nbsp;<code>if-else<\/code>&nbsp;condition in a single line instead of writing in multiple lines.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">seq = [\"Volkswagen\", \"Audi\", \"Porsche\", \"Jaguar\"]\n\nfor cars in seq:\n    if \"a\" in cars:\n        print(cars)\n    else:\n        print(f\"No match found in {cars}\")<\/pre><\/div>\n\n\n\n<p>We can wrap the above code in a single line using list comprehension.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">output = [cars if \"a\" in cars else f\"No match found in {cars}\" for cars in seq]<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-lambda-function\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-lambda-function\"><\/a>Lambda Function<\/h1>\n\n\n\n<p>The Lambda function is also known as the anonymous function. We can define an anonymous function using a&nbsp;<code>lambda<\/code>&nbsp;keyword and then provide an expression.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">num_cube = lambda num: num * num * num\nprint(num_cube(3))<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-creating-an-array-from-random-numbers\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-creating-an-array-from-random-numbers\"><\/a>Creating an array from random numbers<\/h1>\n\n\n\n<p>An array is a collection of elements of the same data types stored in contiguous memory locations with assigned index values that help locate them.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">import numpy as np\n\nnp.random.randint(16, size=(2, 3, 2))<\/pre><\/div>\n\n\n\n<p>The above code generates a 3D array of shapes&nbsp;<code>(2, 3, 2)<\/code>&nbsp;from random numbers between&nbsp;<strong>0<\/strong>&nbsp;and&nbsp;<strong>16<\/strong>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-using-walrus-operator\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-using-walrus-operator\"><\/a>Using walrus operator<\/h1>\n\n\n\n<p>This operator is used to assign values to the variables within an expression. It is an assignment operator represented by the sign&nbsp;<code>:=<\/code>. This feature was added in Python version 3.8.<\/p>\n\n\n\n<p>We have a Python program that takes the input from the user, if that input is 7, it will print something, if not, it will return nothing.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">inp = input(\"Enter the number: \")\n\nwhile inp == \"7\":\n    print(\"You found it\")\n    break<\/pre><\/div>\n\n\n\n<p>The above code can be written in a single line.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">while (number := input(\"Enter the number: \")) == \"7\": print(f\"The hidden number {number} found.\")<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-generating-random-numbers\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-generating-random-numbers\"><\/a>Generating random numbers<\/h1>\n\n\n\n<p>The most common way of generating random numbers is by using a library called&nbsp;<code>random<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">import random\nrandom.sample(range(1, 99), 10)<\/pre><\/div>\n\n\n\n<p>This code will generate a list of&nbsp;<strong>10<\/strong>&nbsp;random numbers between&nbsp;<strong>1<\/strong>&nbsp;and&nbsp;<strong>99<\/strong>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-substitute-any-pattern\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-substitute-any-pattern\"><\/a>Substitute any pattern<\/h1>\n\n\n\n<p>We can use the&nbsp;<strong>RegEx<\/strong>&nbsp;(Regular Expression) to substitute any pattern. Let&#8217;s say we have text data in which we have to substitute letters starting and ending from&nbsp;<code>*<\/code>&nbsp;(asterisk).<\/p>\n\n\n\n<p><code>text = \"The *big* data got bigger and bigger. It is called *big* data because of having *big* data\"<\/code><\/p>\n\n\n\n<p>The code to substitute the above pattern.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">import re\nre.sub('\\*(.*?)\\*', \"small\", text)<\/pre><\/div>\n\n\n\n<p>The pattern&nbsp;<code>\\*(.*?)\\*<\/code>&nbsp;matches the characters starting and ending with&nbsp;<code>*<\/code>, and it has a group capture that captures the text between&nbsp;<code>*<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-remove-duplicates\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-remove-duplicates\"><\/a>Remove duplicates<\/h1>\n\n\n\n<p>To remove the duplicate values from the Python&nbsp;<strong><em>list<\/em><\/strong>, convert that list to the&nbsp;<code>set<\/code>. Consider the following example to understand it better.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">lst = [2, 3, 2, 3, 44, 3, 2, 45, 44]\n\nnew_lst = set(lst)\n\n....\n{2, 3, 44, 45}<\/pre><\/div>\n\n\n\n<p>All the duplicate values were removed because the&nbsp;<strong><em>set<\/em><\/strong>&nbsp;doesn&#8217;t allow identical values.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-replacing-a-word\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-replacing-a-word\"><\/a>Replacing a word<\/h1>\n\n\n\n<p>When working on textual data in Python, the&nbsp;<code>replace()<\/code>&nbsp;method can come in handy to replace a particular text with a text of your choice.<\/p>\n\n\n\n<p><code>text = \u201cThe big data got bigger and bigger. It is called big data because of having big data\u201d<\/code><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">new_text = text.replace(\"data\", \"dataset\")\nprint(new_text)<\/pre><\/div>\n\n\n\n<p>The above code will replace the word&nbsp;<code>data<\/code>&nbsp;with&nbsp;<code>dataset<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-multiple-inputs-simultaneously\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-multiple-inputs-simultaneously\"><\/a>Multiple inputs simultaneously<\/h1>\n\n\n\n<p>If you are working on a project that wants to take multiple user inputs simultaneously, the following one-liner will come in handy.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-geekpython wp-block-embed-geekpython\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><blockquote class=\"wp-embedded-content\" data-secret=\"mteIeilUBh\"><a href=\"https:\/\/geekpython.in\/multiple-inputs-in-python\">Take Multiple Inputs From The User In A Single Line Of Python Code<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Take Multiple Inputs From The User In A Single Line Of Python Code&#8221; &#8212; GeekPython\" src=\"https:\/\/geekpython.in\/multiple-inputs-in-python\/embed#?secret=gyNB72ZFQY#?secret=mteIeilUBh\" data-secret=\"mteIeilUBh\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">input(\"Enter your inputs: \").split()<\/pre><\/div>\n\n\n\n<p>The user can enter unlimited inputs and get those in the form of a list because the&nbsp;<code>split()<\/code>&nbsp;method will convert the string input into a list.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-multiple-variable-assignments\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-multiple-variable-assignments\"><\/a>Multiple variable assignments<\/h1>\n\n\n\n<p>Using a comma, we can assign multiple values to the variables simultaneously. A value of any data type can be assigned to the variable.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">a, b, c = {1, 2, 3}, 5.5, \"Hello World\"\nprint(a, b, c)\n....\n{1, 2, 3} 5.5 Hello World<\/pre><\/div>\n\n\n\n<p>We assigned a&nbsp;<strong>set<\/strong>&nbsp;to variable&nbsp;<code>a<\/code>, a&nbsp;<strong>float<\/strong>&nbsp;to variable&nbsp;<code>b<\/code>, and a&nbsp;<strong>string<\/strong>&nbsp;to a variable&nbsp;<code>c<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-writing-in-a-file\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-writing-in-a-file\"><\/a>Writing in a file<\/h1>\n\n\n\n<p>We can write some data into a file by opening it with the&nbsp;<code>open()<\/code>&nbsp;function and then using the&nbsp;<code>write()<\/code>&nbsp;method.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">with open(\"hello.txt\", \"w\") as f: f.write(\"Welcome to GeekPython\")<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-reading-a-file\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-reading-a-file\"><\/a>Reading a file<\/h1>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">with open(\"hello.txt\") as f: data = [line for line in f]\nprint(data)<\/pre><\/div>\n\n\n\n<p>In the above code, first, we open a file and use the&nbsp;<code>for<\/code>&nbsp;loop to read the content of the file line by line.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-numbering-each-item-in-a-list\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-numbering-each-item-in-a-list\"><\/a>Numbering each item in a list<\/h1>\n\n\n\n<p>We can add a counter to each item in the existing list using Python&#8217;s built-in&nbsp;<code>enumerate()<\/code>&nbsp;function.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-geekpython wp-block-embed-geekpython\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><blockquote class=\"wp-embedded-content\" data-secret=\"GjQ6wVsT1o\"><a href=\"https:\/\/geekpython.in\/python-enumerate-function-with-example-beginners-guide\">Python enumerate() Function With Example &#8211; Beginner&#8217;s Guide<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Python enumerate() Function With Example &#8211; Beginner&#8217;s Guide&#8221; &#8212; GeekPython\" src=\"https:\/\/geekpython.in\/python-enumerate-function-with-example-beginners-guide\/embed#?secret=pbT55J2GIH#?secret=GjQ6wVsT1o\" data-secret=\"GjQ6wVsT1o\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">seq = [\"Volkswagen\", \"Audi\", \"Porsche\", \"Jaguar\"]\nvar = list(enumerate(seq, start=0))\n....\n[(0, 'Volkswagen'), (1, 'Audi'), (2, 'Porsche'), (3, 'Jaguar')]<\/pre><\/div>\n\n\n\n<p>We can start counting from any number by providing the starting number to the&nbsp;<code>start<\/code>&nbsp;argument.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-merging-items-from-the-lists\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-merging-items-from-the-lists\"><\/a>Merging items from the lists<\/h1>\n\n\n\n<p>We can merge two iterators using the&nbsp;<code>zip()<\/code>&nbsp;function. It takes the iterable and iterates them parallelly, producing tuples of each item from the iterable.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-geekpython wp-block-embed-geekpython\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><blockquote class=\"wp-embedded-content\" data-secret=\"QaiGM3rWaA\"><a href=\"https:\/\/geekpython.in\/zip-function-in-python-usage-and-examples-with-code\">zip() Function In Python &#8211; Usage &amp; Examples With Code<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;zip() Function In Python &#8211; Usage &amp; Examples With Code&#8221; &#8212; GeekPython\" src=\"https:\/\/geekpython.in\/zip-function-in-python-usage-and-examples-with-code\/embed#?secret=7CfcxBkIS5#?secret=QaiGM3rWaA\" data-secret=\"QaiGM3rWaA\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">languages = [\"Python\", \"JavaScript\", \"C\", \"C++\"]\nfounded = [1991, 1995, 1972, 1985]\nmapping = list(zip(languages, founded))<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-sorting-a-list\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-sorting-a-list\"><\/a>Sorting a list<\/h1>\n\n\n\n<p>We can sort a list in ascending or descending order. Let&#8217;s say we have a list of names.<\/p>\n\n\n\n<p><code>my_lst = [\"Rishu\", \"Rishi\", \"Yashwant\", \"Abhishek\", \"Sachin\", \"Yogesh\"]<\/code><\/p>\n\n\n\n<p>To sort the above list in ascending order(alphabetically), we have to write the following code.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">my_lst.sort()\n...\n['Abhishek', 'Rishi', 'Rishu', 'Sachin', 'Yashwant', 'Yogesh']<\/pre><\/div>\n\n\n\n<p>We can use the&nbsp;<code>reverse=True<\/code>&nbsp;inside&nbsp;<code>sort<\/code>&nbsp;method to sort the list in descending order.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-copying-an-entire-directory-or-a-file\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-copying-an-entire-directory-or-a-file\"><\/a>Copying an entire directory or a file<\/h1>\n\n\n\n<p>Copying files or even an entire directory can be overwhelming. We can automate the task of copying files or directories using the&nbsp;<code>shutil<\/code>&nbsp;module in Python.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-geekpython wp-block-embed-geekpython\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><blockquote class=\"wp-embedded-content\" data-secret=\"ZfLefDBWw8\"><a href=\"https:\/\/geekpython.in\/shutil-module-in-python\">Perform High-Level File Operations In Python &#8211; shutil Module<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Perform High-Level File Operations In Python &#8211; shutil Module&#8221; &#8212; GeekPython\" src=\"https:\/\/geekpython.in\/shutil-module-in-python\/embed#?secret=5HMmQYQfm0#?secret=ZfLefDBWw8\" data-secret=\"ZfLefDBWw8\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">import shutil\nshutil.copytree('src_path', 'dst_path')<\/pre><\/div>\n\n\n\n<p>If we wanted to copy only the files.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">shutil.copy('src_path', 'dst_path')<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-list-the-directories\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-list-the-directories\"><\/a>List the directories<\/h1>\n\n\n\n<p>Python&nbsp;<code>os<\/code>&nbsp;module provides a method to list the directories of the specified path.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">import os\n\ndir = os.listdir(\"D:\/SACHIN\/Pycharm\/one-liners\")<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-swapping-variables\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-swapping-variables\"><\/a>Swapping variables<\/h1>\n\n\n\n<p>If we use a traditional approach, we will write a Python program like the following.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># Using naive swapping\nvar = a\na = b\nb = var\n----------OR----------\n# Using XOR swapping\nx = x^y\ny = x^y\nx = x^y<\/pre><\/div>\n\n\n\n<p>Instead of using the two methods mentioned above, we can do it in a single line using commas.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">a, b = b, a<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-reverse-a-list\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-reverse-a-list\"><\/a>Reverse a list<\/h1>\n\n\n\n<p>We can use the&nbsp;<code>reverse()<\/code>&nbsp;method to reverse the order of the elements in the list.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">seq = [\"Volkswagen\", \"Audi\", \"Porsche\", \"Jaguar\"]\nseq.reverse()<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/one-liners-in-python#heading-conclusion\"><\/a>Conclusion<\/h1>\n\n\n\n<p>The one-liners we&#8217;ve seen above help us in everyday programming and enhance our code quality. These single-line codes can save us lots of time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python is known for its simplicity and readability. Python provides flexibility to write complex code straightforwardly, and writing code in Python is like writing the English language. Python is popular because of its self-explanatory syntax and power to restrict long programs to a few lines. One-liners are one of the powers Python has, allowing users [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":884,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2,7],"tags":[31],"class_list":["post-882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-python-tips","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=882"}],"version-history":[{"count":3,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/882\/revisions"}],"predecessor-version":[{"id":1347,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/882\/revisions\/1347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/884"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}