All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Prettyprint a JSON File in Python

In Python, there are 2 ways to prettyprint a JSON file. Using json module The json module already implements some basic pretty printing in the dump and dumps functions, with the indent parameter that specifies how many spaces to indent by: #!/us...
Patcher56

How to Pretty-Print Json in Go

In Golang, there are 2 ways to pretty-print json. Using json.MarshalIndent Function MarshalIndent is like Marshal but applies Indent to format the output. Each JSON element in the output will begin on a new line beginning with prefix followed by one...
ada

How to print a formatted string in Rust

Rust String Formatting and Printing Best Practices.Using println! Prints to the standard output, with a newline. Use the format! syntax to write data to the standard output. See std::fmt for more information. fn main() { let name = "Bob"; pri...
aweis

How to get the first and last day of the current month in Go

In Golang, there are two ways to get the start and end date of the current month.Using time.AddDate Function AddDate returns the time corresponding to adding the given number of years, months, and days to t. For example, package main import ( "fm...
Tomoki

How to join a slice of strings into a single string in Go

Convert Slice to String in Golang.Using strings.Join Function Converting a slice of strings to a single string is pretty easy to do in Go. The strings.Join() method is present in the standard library for this purpose, and its usage is shown below: p...
Tomoki

How to convert string to json in Python

Converting Json to string in Python.Decoding JSON To convert string to json in Python, use the json.loads() function. The json.loads() is a built-in Python function that accepts a valid json string and returns a dictionary to access all elements. The...
pooriabt

How to install clipboard.js

A modern approach to copy text to clipboard No Flash. No frameworks. --pname-- lets you easily copy text to the clipboard. At 3kb gzipped and no need for Flash, it’s a great lightweight way to allow your visitors to copy bits of text and code on your...

How to install Highlight.js

Highlight.js is a syntax highlighter written in JavaScript. It works in the browser as well as on the server.Highlight.js is a syntax highlighter written in JavaScript. It works in the browser as well as on the server. It works with pretty much any m...