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

How to Make a List of Alphabet Characters in Python

In Python, there are 2 ways to make a list of alphabet characters. Using string Module The string.ascii_lowercase is a pre-initialized string used as string constant. In Python, string ascii_lowercase will give the lowercase letters ‘abcdefghijklmno...
Patcher56

How to Extract All the Numbers Contained in a String in Python

In Python, there are 2 ways to extract all the numbers contained in a string. Using List Comprehension List comprehensions provide a concise way to create lists. If you only want to extract only positive integers, try the following: #!/usr/bin/...
Sambhav Khandelwal

How to Remove a Trailing Newline in Python

In Python, there are 4 ways to remove a trailing newline. Using rstrip Method The str.rstrip() method returns a copy of the string with trailing characters removed. For example, #!/usr/bin/python3 s = "\nab c\r\n" # str.rstrip([chars]) n = s....
Tomoki

How to Get the Current Time in Python

In Python, there are 2 ways to get the current time. Using datetime Module The datetime module supplies classes for manipulating dates and times. See the following example: #!/usr/bin/python3 # -*- coding: utf8 -*- # Import module import datet...
Patcher56

How To Install Go in Linux

In Golang, there are 2 ways to install Go in Linux.Download Packages Download packages for Windows 64-bit, macOS, Linux, and more. Go install Linux Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extr...
Unused

How To Make a For Loop and Range in Rust

In Rust, there are 3 ways to support For Loop expression.Using while Expression A while loop begins by evaluating the boolean loop conditional operand. fn main() { let mut i = 0; while i < 3 { println!("{}", i); i += 1; } // Vec ...
ada

How to Read a File Line-by-Line in Python

In Python, there are 3 ways to read a file line-by-line. Using For Loop For reading lines from a file, you can loop over the file object. This is memory efficient, fast, and leads to simple code: #!/usr/bin/python3 # -*- coding: utf8 -*- # read a...
pooriabt

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 Install Rust in Linux

In Rust, there are two ways to install rust in Linux.Running the following in your terminal If you’re running macOS, Linux, or another Unix-like OS. To download Rustup and install Rust, run the following in your terminal, then follow the on-screen i...
pooriabt

How to convert an int to a string type in Go

3 ways to convert int64 to string in Golang.Using strconv.Itoa Function The code snippet below shows how to convert an int to a string using the Itoa function. package main import ( "fmt" "strconv" ) func main() { s := strconv.Itoa(100) f...
aweis

How to format a string in Python

Python String Formatting Best Practices.Fancier Output Formatting To use formatted string literals, begin a string with f or F before the opening quotation mark or triple quotation mark. Inside this string, you can write a Python expression between {...
Sambhav Khandelwal

How to use string constants in Python

String Constants Best Practice.String Constants in Python The constants defined in this module are: String constants: string.ascii_lettersThe concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale...
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

Built-in Types in Python

Python’s Core Data Types.Core Data Types The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Built-in objects preview: Object type: Numbersint, float, complex.Strings'spam', "Bob's", b'a\x01c', u'sp\xc4m...
Unused

How many keywords are there in Go

List of Golang Keywords. Keywords The following keywords are reserved and may not be used as identifiers. break default func interface select case defer go map struct chan else goto package switch const ...
Sambhav Khandelwal