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

How to Delete a Character from a String in Python

In Python, there are 2 ways to delete a character from a string. Using replace Method The str.replace(old, new[, count]) method returns a copy of the string with all occurrences of substring old replaced by new. If the optional argument count is giv...
Unused

How to Delete an Element from an Array in PHP

In PHP, there are 3 ways to delete an element from an array. Using unset Function The unset(mixed $var, mixed ...$vars): void function destroys the specified variables. For example, $arr = ["a", "b", "d"]; unset($arr[1]); print_r($arr); Arr...
Sambhav Khandelwal

How to Delete the Contents of a Folder in Python

In Python, there are 2 ways to delete the contents of a folder. Using rmtree Method The shutil.rmtree() method deletes an entire directory tree; path must point to a directory. For example, #!/usr/bin/python3 # Import module import os, shutil ...
Tomoki

How to Delete a List Element by Value in Python

In Python, there are 3 ways to delete a list element by value. Using list.remove Function The list.remove(x) function removes the first item from the list whose value is equal to x. It raises a ValueError if there is no such item. See the following...
Unused

How to Delete an Item from a Dictionary in Python

In Python, there are 2 ways to delete an item from a dictionary. Using del Statement The easiest way to delete an item from a dictionary in Python: #!/usr/bin/python3 m = {"a":1, "b":2} # remove a if 'a' in m: del m['a'] print(m) {'b': 2...
Patcher56

How to Delete or Remove keys in a Map in Go

In Golang, using the delete function is the easiest way to delete keys in a map. Using delete Function Syntax The syntax of the delete function is shown below. func delete(m map[Type]Type1, key Type) delete Usage The delete built-in funct...
Patcher56

How to Remove an Element From a List by Index in Python

In Python, there are 3 ways to remove an element from a list by index. Using del Keyword There is a way to remove an item from a list given its index instead of its value. For example, #!/usr/bin/python3 # -*- coding: utf8 -*- l = [1, 2, 3, 4]...
Unused

How to Remove Packages Installed with go get in Go

In Golang, there are 3 ways to remove packages installed with go get. Using go mod tidy go mod tidy ensures that the go.mod file matches the source code in the module. It adds any missing module requirements necessary to build the current module’s p...
ada

How to delete an element from a slice in Go

Removing a string from a slice in Golang.Faster Version If you do not care about ordering, you have the much faster possibility to replace the element to delete with the one at the end of the slice and then return the n-1 first elements: package mai...
pooriabt

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

How to use the find command in Linux

search for files and directories based on their permissions, type, date, ownership, size, and more. find is a command-line utility that locates files based on some user-specified criteria and either prints the pathname of each matched object or, if ...

How to use the go build command line

compile packages and dependencies. Build compiles the packages named by the import paths, along with their dependencies, but it does not install the results. Build go build go build hello.go ls -lh 1.9M Jun 29 17:38 hello ...

How to use the Angular CLI build command line

Compiles an Angular app into an output directory named dist/ at the given output path.The command can be used to build a project of type "application" or "library". When used to build a library, a different builder is invoked, and only the ts-config,...