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...
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...
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
...
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...
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...
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...
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]...
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...
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...
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 ...
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 ...
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
...
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,...