C/C++ bash, python and VUE Code Snippets
Vscode extension for C/C++, bash, python and vue, for easy to program.
Github
https://github.com/womuer/CodeAssist/tree/master
Usage
Type a part of the keywords in snippet e.g., "for" and press enter.
for // Creates a for loop snippet
If the snippet does not appear, you can also just press Ctrl + Space (works on Windows, Linux, or Mac) to access the available snippets in the editor.
Installation
You can find this extension VScode extension market, but now it's not upload in that.
- Install Visual Studio Code
- Launch VS Code
- From the command palette
Ctrl
+Shift
+P
(Windows, Linux) or Cmd
+Shift
+P
(OSX)
- Type
ext install
or just simply select Install Extension
- Choose the extension - CodeAssist Snippets
- Relaunch VS Code
C/C++Snippets
for
forr
while
if
else
else
if
enum
ifdef
ifndef
if
struct
switch
union
inc
inc
def
def
arrBubblesort
arrFindminarr
arrSelectionSort
arrQuickSort
arrfindDuplicates
arrFindMaxAndMin
arrMergeSortedArrays
arrCountElement
arrElemSum
arrCalculateMedian
runStateMachine
listRemoveNthFromEnd
reverseBitsuint
hammingWeight
isValidBrackets
bitwiseAnd
listRemoveValElements
listReverseList
arrUniqueOccurrences
arrMaxSubarray
strIsPalindrome
strRomanToInt
arrSingleNumber
listDetectCycle
divideFindMin
arrThreeSumClosest
performFFT
KalmanFilter
arrMajorityElement
arrMaximumUniqueSubarray
strHalvesAreAlike
bSTIterator
algoMaxIceCream
arrContainsDuplicate
algoMaximumBags
algominPathCost
algoisPowerOfTwo
isAnagram
arrRemoveDuplicates
arrRemoveElement
strFindSubStr
arrmoveZeroes
strlengthOfLongestSubstring
strlongestValidParentheses
strreverseString
arrsearchInsert
isPerfectSquare
algosolveSudoku
strfirstUniqChar
strfindTheDifference
algotrap
strcountSegments
algoBFSjumpGame
BFS
bithammingDistance
bitfindComplement
floatPow
strdetectCapitalUse
arrayPairSum
algotrimBST
"compareTimeStrings",
"compareTimeWithCurrentTime",
"strfindStringInArray",
"strremoveSpaces",
"strlen",
"strcmp",
"sprintf",
"timeval_addMsecs",
"timeval_toMsecs",
"timeval_difference",
"timeval_add_timeval",
"timeval_durationFromNow",
"数组冒泡排序",
"数组查找数组最小值",
"数组选择排序",
"数组快速排序",
"数组查找重复元素",
"数组查找最大值和最小值",
"数组合并两个有序数组",
"数组计数元素出现次数",
"数组求和",
"数组查找中位数",
"状态机",
"链表删除倒数第个节点",
"位反转32",
"求二进制1的个数",
"检查括号配对",
"位与",
"链表删除给定值",
"链表反转",
"数组元素是否唯一",
"数组最大子数组和",
"字符串回文判断",
"字符串罗马数字转int",
"数组只出现一次的数",
"链表存在环",
"数组二分法查找最小值",
"数组最接近目标的值",
"傅里叶变换",
"卡尔曼滤波器",
"数组多数投票算法",
"数组查找数组中的具有最大唯一元素和的子数组",
"字符串前半部分和后半部分是否包含相同数量的元素",
"二叉搜索树迭代升序遍历",
"算法贪心算法",
"数组是否包含重复元素",
"算法背包的容量限制",
"算法最短路径成本",
"算法是否是2的幂",
"算法字母异位词",
"数组删除重复元素",
"数组删除元素",
"字符串查找字串",
"数组将零移至数组末尾",
"字符串最长无重复子串",
"字符串最长括号有效子串",
"字符串反转",
"字符串插入查找",
"数判断是否为完美平方",
"算法数独问题",
"字符串第一个不重复的元素",
"字符串匹配",
"算法接雨水问题",
"字符串计算单词数",
"算法跳跃问题",
"二进制表示中有多少位不同",
"补数",
"算法浮点数幂计算",
"字符串检查大小写",
"数组分割查找两两配对元素最小值",
"算法二叉搜索树修剪函数",
"比较两个时间字符串",
"时间字符串和当前时间作比较",
"字符串数组中匹配字符串",
"字符串移除空格",
"字符串长度",
"字符串比较",
"时间给定时间添加毫秒",
"时间转毫秒",
"时间差",
"时间两个时间相加",
"时间与当前时间差值",
bash Snippets
archive compress tar.gz
archive tar.gz
archive compress tar.xz
archive tar.xz
archive compress .zip
archive zip
archive decompress tar.gz
decompress tar.gz
archive decompress tar.xz
decompress tar.xz
archive decompress .zip
archive unzip
array all
array at index
array concat
array contains
array declare
array delete at
array delete
array filter
array iterate
array forEach
array length
array print
echo array
array push
array add
array slice
array range
array replace
array reverse
array set element
command failure check
cmd failure check
hide command error
don't show command error
if command exists
if cmd exists
command nice
cmd nice
command renice
cmd renice
command
cmd
command substitution
cmd substitution
command success check
cmd success check
crypto base64 decode
crypto base64 encode
crypto hash
date now dayOfMonth
date now dayOfWeek
date now dayOfYear
date now short
date now monthName
date now monthNumber
date now UTC
date now year
event CTRL+C
event terminated
event EXIT
iterate directories
directory create nested
directory create
directory delete nested
directory remove nested
file delete
file remove
file read
file search
search in files
find in files
file write multiline sudo
file write multiline
file write
iterate files
file find
directory find
if directory exists
if file executable
if file link
if file exists
if file not empty
if file readable
if file writeable
if file newer
if file older
if file =
if path exists
remove old/new files/directories
if float =
if double =
if float >=
if double >=
if float >
if double >
if float <=
if double <=
if float <
if double <
if float !=
if double !=
fn animation animate
fn animation pacman
fn banner color
fn banner simple
fn import
fn options
fn input choice
fn checkbox
fn input multichoice
fn math average
fn math factorial
fn math fibonacci series
fn math fibonacci
fn math product
fn math sum
fn progress
fn scan local
fn time format seconds
fn urldecode
fn urlencode
fn version compare
fn semver compare
fx animation animate
fx animation pacman
fx banner color
fx banner simple
fx import
fx options
fx input choice
fx checkbox
fx input multichoice
fx math fibonacci
fx math average
fx math factorial
fx math fibonacci series
fx math product
fx math sum
fx progress
fx scan local
fx time format seconds
fx urldecode
fx urlencode
fx version compare
fx semver compare
ftp delete file
ftp download
ftp list
ftp rename
ftp upload
function arguments
func args
function arguments count
func args count
function
func
function return value
func return value
func ret val
git branch create
git branch delete local
git branch delete remote
git branch list
git branch push
git branch rename
git changes revert
git clone branch https
git clone branch
git clone https
git clone
git commit list notPushed
git commit search
git commit undo
git commit
git config list
git config set
git patch apply
git patch create
git remote list
git remote urlAdd https
git remote url add https
git remote urlAdd
git remote url add
git remote urlAdd ssh
git remote url add ssh
git remote urlChange https
git remote url change https
git remote urlChange
git remote url change
git remote urlChange ssh
git remote url change ssh
git tag commit
git commit tag
git tag list
git tag remote delete
git tag remote push
http cookie
http download
http GET
http DELETE
http header
http POST file
http POST
http PUT
input password
input text
ask question
if int =
if int >=
if int >
if int <=
if int <
if int !=
for ij
for i
for in collection
for in column
for in range
if
iff not
iff
loop infinite
switch case
loop until
loop while
ip local IPs
ip info
ip public
math +
math const 𝛾
math const e
math const Ω
math const ϕ
math const π
math --
math /=
math /
expr
arithmetic
math ++
let
math -=
math %=
math %
math *=
math *
math +=
math ^
math 0.00
math random
math √
math sqrt
math -
am I not root
am I not sudo
am I root
am I sudo
animation frame
argument parsing
parse args
echo text
print text
echo variable
print variable
exit code
os is
region
section
shebang
first line
sleep
stopwatch elapsed
stopwatch start
stopwatch stop
summary
timeout
color black
color blue
color cyan
color green
color magenta
color red
color white
color yellow
format bold
format dim
format italic
format reverse
process ID(s)
process instances
process kill
process list all
process Name by ID
string concat
string + string
string contains
if string contains
string indexOf
if string empty
if string =
string equal
if string not empty
if string !=
string not equal
string length
string random
string replace
string reverse
string substring count
string substring frequency
string substring
string toLower
string toUpper
string trim all
string trim left
string trim right
string trim
system distro codename
system distro name
system distro version
system kernel name
system kernel release
system memory info
system processor architecture
system cpu architecture
system cpu arch
system processor count
system cpu count
system processor model
system cpu model
system processor type
system cpu type
service manage
systemd manage
system uptime seconds
system uptime
time seconds epoch
time now local
time now UTC
variable assign
variable set
variable default value
assign if empty
var
variable read
variable expand
vue Snippets
Including most of the API of Vue.js 2. You can type vcom
, choose VueConfigOptionMergeStrategies
, and press ENTER, then Vue.config.optionMergeStrategies
appear on the screen.
As shown in the table below, snippet vmData
has body like ${this, vm}.$data
will provides choice this.$data
and vm.$data
to you.
| Prefix | JavaScript Snippet Content |
| ------ | ------------ |
| `import` | `import ... from ...` |
| `newVue` | `new Vue({...})` |
| `VueConfigSilent` | `Vue.config.silent = true` |
Prefix |
HTML Snippet Content |
template |
<template></template> |
script |
<script></script> |
style |
<style></style> |
vText |
v-text=msg |
vHtml |
v-html=html |
vShow |
v-show |
vIf |
v-if |
vElse |
v-else |
vElseIf |
v-else-if |
vForWithoutKey |
v-for |
vFor |
v-for="" :key="" |
vOn |
v-on |
vBind |
v-bind |
vModel |
v-model |
vPre |
v-pre |
vCloak |
v-cloak |
vOnce |
v-once |
key |
:key |
ref |
ref |
slotA |
slot="" |
slotE |
<slot></slot> |
slotScope |
slot-scope="" |
component |
<component :is=''></component> |
keepAlive |
<keep-alive></keep-alive> |
transition |
<transition></transition> |
transitionGroup |
<transition-group></transition-group> |
enterClass |
enter-class='' |
leaveClass |
leave-class='' |
appearClass |
appear-class='' |
enterToClass |
enter-to-class='' |
leaveToClass |
leave-to-class='' |
appearToClass |
appear-to-class='' |
enterActiveClass |
enter-active-class='' |
leaveActiveClass |
leave-active-class='' |
appearActiveClass |
appear-active-class='' |
beforeEnterEvent |
@before-enter='' |
beforeLeaveEvent |
@before-leave='' |
beforeAppearEvent |
@before-appear='' |
enterEvent |
@enter='' |
leaveEvent |
@leave='' |
appearEvent |
@appear='' |
afterEnterEvent |
@after-enter='' |
afterLeaveEvent |
@after-leave='' |
afterAppearEvent |
@after-appear='' |
enterCancelledEvent |
@enter-cancelled='' |
leaveCancelledEvent |
@leave-cancelled='' |
appearCancelledEvent |
@appear-cancelled='' |
Prefix |
Vue Router Snippet Content |
routerLink |
<router-link></router-link> |
routerView |
<router-view></router-view> |
to |
to="" |
tag |
tag="" |
newVueRouter |
const router = newVueRouter({ }) |
routerBeforeEach |
router.beforeEach((to, from, next) => { } |
routerBeforeResolve |
router.beforeResolve((to, from, next) => { } |
routerAfterEach |
router.afterEach((to, from) => { } |
routerPush |
router.push() |
routerReplace |
router.replace() |
routerGo |
router.back() |
routerBack |
router.push() |
routerForward |
router.forward() |
routerGetMatchedComponents |
router.getMatchedComponents() |
routerResolve |
router.resolve() |
routerAddRoutes |
router.addRoutes() |
routerOnReady |
router.onReady() |
routerOnError |
router.onError() |
routes |
routes: [] |
beforeEnter |
beforeEnter: (to, from, next) => { } |
beforeRouteEnter |
beforeRouteEnter (to, from, next) { } |
beforeRouteLeave |
beforeRouteLeave (to, from, next) { } |
scrollBehavior |
scrollBehavior (to, from, savedPosition) { } |
Prefix |
Vuex Snippet Content |
newVuexStore |
const store = new Vuex.Store({ }) |
Prefix |
Nuxt.js Snippet Content |
nuxt |
<nuxt/> |
nuxtChild |
<nuxt-child/> |
nuxtLink |
<nuxt-link to=""/> |
asyncData |
asyncData() {} |
Python Base snippets
Abbreviation |
Description |
env |
#!/usr/bin/env python |
env3 |
#!/usr/bin/env python3 |
enc |
# -- coding=utf-8 -- |
enco |
# coding=utf-8 |
fenc |
from future import ... |
fenco |
from future import ... (no -*- ) |
im |
import |
fim |
from ... import ... |
class |
New class |
classd |
New dataclass |
defs |
New method |
def |
New function |
dowhile |
Do while structure |
adef |
Async function |
property |
New property |
enum |
New Enum |
if |
if |
for |
for |
lambda |
lambda expression |
while |
while |
try |
try:except: |
tryef |
try:except:else:finally: |
trye |
try:except:else: |
tryf |
try:except:finally: |
s |
self |
__ |
magic |
ifmain |
if name == "main" |
Python Comprehensions
Abbreviation |
Description |
lc |
List comprehension |
lcie |
List comprehension if else |
lci |
List comprehension if filter |
dc |
Dictionary comprehension |
dci |
Dictionary comprehension if filter |
sc |
Set comprehension |
sci |
Set Comprehension if filter |
gc |
Generator comprehension |
gci |
Generator comprehension if filter |
Python Unittest
Abbreviation |
Description |
ase |
Assert equal |
asne |
Assert not equal |
asr |
Assert raises |
ast |
Assert True |
asf |
Assert False |
asi |
Assert is |
asint |
Assert is not |
asino |
Assert is None |
asinno |
Assert is not None |
asin |
Assert in |
asni |
Assert not in |
as |
Assert |
fail |
Fail (a test) |
Python Debugging
Abbreviation |
Description |
pdb |
PDB set trace |
ipdb |
iPDB set trace |
rpdb |
rPDB set trace |
pudb |
PuDB set trace |
Python Tkinter
Abbreviation |
Description |
imtk |
Import Tkinter py2 |
imtk3 |
Import tkinter py3 |
config |
Root configuration |
button |
Button |
label |
Label |
frame |
Frame |
entry |
Entry |
grid |
Grid |
sticky |
Sticky |
checkbutton |
Check button |
mainloop |
Main loop |
pack |
Pack |
side |
Side |
bind |
Bind |
menu |
Menu |
addcascade |
Add cascade |
addcommand |
Add command |
addseperator |
Add seperator |
Python util Snippets
Snippet Shorcut |
Snippet Description |
pyif |
If Statement |
pyfor |
For loop |
pywhile |
While loop |
pytry |
Try Catch Block |
pyfunc |
Sample Function |
pylambda |
Lambda Function |
pyclambda |
Complex Lambda Functions |
pyenv |
Sample Environment Variable Reader |
pyenvvar |
Add environment Variable |
pyclass |
Classes |
pyclfunc |
Class Functions |
pyenum |
Enum |
pyinum |
Int Enum |
built-in methods code snippets |
Description |
abs |
Returns the absolute value of a number |
all |
Returns True if all items in an iterable object are true |
any |
Returns True if any item in an iterable object is true |
ascii |
Returns a readable version of an object. Replaces none-ascii characters with escape character |
bin |
Returns the binary version of a number |
bool |
Returns the boolean value of the specified object |
bytearray |
Returns an array of bytes |
bytes |
Returns a bytes object |
callable |
Returns True if the specified object is callable, otherwise False |
chr |
Returns a character from the specified Unicode code. |
delattr |
Deletes the specified attribute (property or method) from the specified object |
dict |
Returns a dictionary (Array) |
dir |
Returns a list of the specified object's properties and methods |
divmod |
Returns the quotient and the remainder when argument1 is divided by argument2 |
enumerate |
Takes a collection (e.g. a tuple) and returns it as an enumerate object |
eval |
Evaluates and executes an expression |
exec |
Executes the specified code (or object) |
filter |
Use a filter function to exclude items in an iterable object |
float |
Returns a floating point number |
frozenset |
Returns a frozenset object |
getattr |
Returns the value of the specified attribute (property or method) |
globals |
Returns the current global symbol table as a dictionary |
hasattr |
Returns True if the specified object has the specified attribute (property/method) |
hash |
Returns the hash value of a specified object |
help |
Executes the built-in help system |
hex |
Converts a number into a hexadecimal value |
int |
Returns an integer number |
id |
Returns the id of an object |
input |
Allowing user input |
isinstance |
Returns True if a specified object is an instance of a specified object |
issubclass |
Returns True if a specified class is a subclass of a specified object |
iter |
Returns an iterator object |
len |
Returns the length of an object |
locals |
Returns an updated dictionary of the current local symbol table |
map |
Returns the specified iterator with the specified function applied to each item |
max |
Returns the largest item in an iterable |
memoryview |
Returns a memory view object |
min |
Returns the smallest item in an iterable |
next |
Returns the next item in an iterable |
object |
Returns a new object |
oct |
Converts a number into an octal |
open |
Opens a file and returns a file object |
ord |
Given a string of length one, return an integer representing the Unicode code point of the character when the argument is a unicode object, or the value of the byte when the argument is an 8-bit string. |
pow |
Return x to the power y |
print |
Prints to the standard output device |
property |
Gets, sets, deletes a property |
range |
Returns a sequence of numbers, starting from 0 and increments by 1 (by default) |
repr |
Returns a readable version of an object |
reversed |
Returns a reversed iterator |
round |
Rounds a numbers |
slice |
Returns a slice object |
sorted |
Returns a sorted list |
staticmethod |
Converts a method into a static method |
str |
Returns a string object |
sum |
Sums the items of an iterator |
super |
Return a proxy object that delegates method calls to a parent or sibling class of type. |
type |
Returns the type of an object |
unichr |
Return the Unicode string of one character whose Unicode code is the integer i. |
vars |
Returns the dict property of an object |
zip |
Returns an iterator, from two or more iterators |
built-in methods code examples |
Description |
built_in.abs=>int |
An example for using abs method |
built_in.abs=>float |
An example for using abs method |
built_in.abs=>complex |
An example for using abs method |
built_in.all=>list_1 |
An example for using all with list |
built_in.all=>list_2 |
An example for using all with list |
built_in.all=>tuple |
An example for using all with tuple |
built_in.all=>set |
An example for using all with set |
built_in.all=>dictionary |
An example for using all with dictionary |
built_in.any=>list_1 |
An example for using all with list |
built_in.ascii=>_list_1 |
An example for using ascii |
built_in.bin=>_1 |
An example for using ascii |
built_in.bool=>_1 |
An example for using bool |
built_in.bytearray=>_1 |
An example for using bool |
built_in.bytes=>_1 |
An example for using bytes |
built_in.callable=>_1 |
An example for using callable |
built_in.callable=>_2 |
An example for using bytes |
built_in.chr=>_1 |
An example for using bytes |
built_in.compile=>_1 |
An example for using compile |
built_in.compile=>_1 |
An example for using compile |
built_in.complex=>_1 |
An example for using complex |
built_in.complex=>_2 |
An example for using complex |
built_in.delattr=>_1 |
An example for using delattr |
built_in.dict=>_1 |
An example for using dict |
built_in.dir=> |
An example for using dict |
built_in.divmod=>_1 |
An example for using divmod |
built_in.enumerate=>_1 |
An example for using enumerate |
built_in.eval=>_1 |
An example for using eval |
built_in.exec=>_1 |
An example for using exec |
built_in.filter=>_1 |
An example for using filter |
built_in.float=>_1 |
An example for using float |
built_in.float=>_2 |
An example for using float |
built_in.format=>_1 |
An example for using format |
built_in.frozenset=>_1 |
An example for using frozenset |
built_in.frozenset=>_2 |
An example for using frozenset |
built_in.frozenset=>_3 |
An example for using frozenset |
built_in.globals=>_1 |
An example for using globals |
built_in.globals=>_2 |
An example for using globals |
built_in.hasattr=> |
An example for using hasattr |
built_in.hex=> |
An example for using hasattr |
built_in.int=>_1 |
An example for using int |
built_in.int=>_2 |
An example for using int |
built_in.id=> |
An example for using id |
built_in.input=>_1 |
An example for using input |
built_in.input=>_2 |
An example for using input |
built_in.isinstance=>_1 |
An example for using isinstance |
built_in.isinstance=>_2 |
An example for using isinstance |
built_in.isinstance=>_3 |
An example for using isinstance |
built_in.issubclass=> |
An example for using isinstance |
built_in.iter=> |
An example for using iter |
built_in.len=>_1 |
An example for using len |
built_in.len=>_2 |
An example for using len |
built_in.list=> |
An example for using list |
built_in.locals=>_1 |
An example for using locals |
built_in.locals=>_2 |
An example for using locals |
built_in.map=>_1 |
An example for using map |
built_in.map=>_2 |
An example for using map |
built_in.max=>_1 |
An example for using max |
built_in.max=>_2 |
An example for using max |
built_in.max=>_3 |
An example for using max |
built_in.memoryview=> |
An example for using memoryview |
built_in.min=>_1 |
An example for using min |
built_in.min=>_2 |
An example for using min |
built_in.min=>_3 |
An example for using min |
built_in.next=>_1 |
An example for using next |
built_in.next=>_2 |
An example for using next |
built_in.object=> |
An example for using object |
built_in.oct=> |
An example for using oct |
built_in.open=> |
An example for using open |
built_in.ord=> |
An example for using ord |
built_in.pow=> |
An example for using pow |
built_in.print=>_1 |
An example for using print |
built_in.print=>_2 |
An example for using print |
built_in.print=>_3 |
An example for using print |
built_in.property=> |
An example for using property |
built_in.range=>_1 |
An example for using range |
built_in.range=>_2 |
An example for using range |
built_in.range=>_3 |
An example for using range |
built_in.reversed=> |
An example for using reversed |
built_in.round=>_1 |
An example for using round |
built_in.round=>_2 |
An example for using round |
built_in.set=> |
An example for using set |
built_in.setattr=> |
An example for using setattr |
built_in.slice=>_1 |
An example for using slice |
built_in.slice=>_2 |
An example for using slice |
built_in.slice=>_3 |
An example for using slice |
built_in.sorted=>_1 |
An example for using sorted |
built_in.sorted=>_2 |
An example for using sorted |
built_in.sorted=>_3 |
An example for using sorted |
built_in.str=> |
An example for using str |
built_in.sum=>_1 |
An example for using sum |
built_in.sum=>_2 |
An example for using sum |
built_in.tuple=> |
An example for using tuple |
built_in.type=> |
An example for using type |
built_in.vars=> |
An example for using vars |
built_in.zip=>_1 |
An example for using zip |
built_in.zip=>_2 |
An example for using zip |
string methods code snippets |
Description |
.capitalize |
Converts the first character to upper case |
.casefold |
Converts string into lower case |
.center |
Returns a centered string |
.count |
Returns the number of times a specified value occurs in a string |
.encode |
Returns an encoded version of the string |
.endswith |
Returns true if the string ends with the specified value |
.expandtabs |
Sets the tab size of the string |
.find |
Searches the string for a specified value and returns the position of where it was found |
.format |
Formats specified values in a string |
.format_map |
Formats specified values in a string |
.index |
Searches the string for a specified value and returns the position of where it was found |
.isalnum |
Returns True if all characters in the string are alphanumeric |
.isalpha |
Returns True if all characters in the string are in the alphabet |
.isdecimal |
Returns True if all characters in the string are decimals |
.isdigit |
Returns True if all characters in the string are digits |
.isidentifier |
Returns True if the string is an identifier |
.islower |
Returns True if all characters in the string are lower case |
.isnumeric |
Returns True if all characters in the string are numeric |
.isprintable |
Returns True if all characters in the string are printable |
.isspace |
Returns True if all characters in the string are whitespaces |
.istitle |
Returns True if the string follows the rules of a title |
.isupper |
Returns True if all characters in the string are upper case |
.join |
Joins the elements of an iterable to the end of the string |
.ljust |
Returns a left justified version of the string |
.lower |
Converts a string into lower case |
.lstrip |
Returns a left trim version of the string |
.maketrans |
Returns a translation table to be used in translations |
.partition |
Returns a tuple where the string is parted into three parts |
.replace |
Returns a string where a specified value is replaced with a specified value |
.rfind |
Searches the string for a specified value and returns the last position of where it was found |
.rindex |
Searches the string for a specified value and returns the last position of where it was found |
.rpartition |
Returns a tuple where the string is parted into three parts |
.rsplit |
Returns a right trim version of the string |
.split |
Splits the string at the specified separator, and returns a list |
.splitlines |
Splits the string at line breaks and returns a list |
.startswith |
Returns true if the string starts with the specified value |
.swapcase |
Swaps cases, lower case becomes upper case and vice versa |
.title |
Converts the first character of each word to upper case |
.translate |
Returns a translated string |
.upper |
Converts a string into upper case |
.zfill |
Fills the string with a specified number of 0 values at the beginning |
string methods code examples |
Description |
string.capitalize=>_1 |
An example for using capitalize |
string.capitalize=>_2 |
An example for using capitalize |
string.casefold=> |
An example for using casefold |
string.center=>_1 |
An example for using center |
string.center=>_2 |
An example for using center |
string.count=>_1 |
An example for using count |
string.count=>_2 |
An example for using count |
string.encode=> |
An example for using encode |
string.endswith=>_1 |
An example for using endswith |
string.endswith=>_2 |
An example for using endswith |
string.expandtabs=>_1 |
An example for using expandtabs |
string.expandtabs=>_2 |
An example for using expandtabs |
string.find=>_1 |
An example for using find |
string.find=>_2 |
An example for using find |
string.find=>_3 |
An example for using find |
string.find=>_4 |
An example for using find |
string.format=> |
An example for using format |
string.format_map=> |
An example for using format_map |
string.index=>_1 |
An example for using index |
string.index=>_2 |
An example for using index |
string.index=>_3 |
An example for using index |
string.index=>_4 |
An example for using index |
string.isalnum=> |
An example for using isalnum |
string.isalpha=> |
An example for using isalpha |
string.isdecimal=> |
An example for using isdecimal |
string.isdigit=> |
An example for using isdigit |
string.isidentifier=> |
An example for using isidentifier |
string.islower=> |
An example for using islower |
string.isnumeric=> |
An example for using isnumeric |
string.isprintable=> |
An example for using isprintable |
string.isspace=> |
An example for using isspace |
string.istitle=> |
An example for using istitle |
string.isupper=> |
An example for using isupper |
string.join=> |
An example for using join |
string.ljust=> |
An example for using ljust |
string.lower=> |
An example for using lower |
string.lstrip=> |
An example for using lstrip |
string.maketrans=> |
An example for using maketrans |
string.partition=> |
An example for using partition |
string.replace=> |
An example for using replace |
string.rfind=> |
An example for using rfind |
string.rindex=> |
An example for using rindex |
string.rpartition=> |
An example for using rpartition |
string.rsplit=> |
An example for using rsplit |
string.split=> |
An example for using split |
string.splitlines=> |
An example for using splitlines |
string.startswith=> |
An example for using startswith |
string.swapcase=> |
An example for using swapcase |
string.title=> |
An example for using title |
string.translate=> |
An example for using translate |
string.upper=> |
An example for using upper |
string.zfill=> |
An example for using zfill |
list methods code snippets |
Description |
.append |
Adds an element at the end of the list |
.clear |
Removes all the elements from the list |
.copy |
Returns a copy of the list |
.count |
Returns the number of elements with the specified value |
.extend |
Add the elements of a list (or any iterable), to the end of the current list |
.index |
Returns the index of the first element with the specified value |
.insert |
Adds an element at the specified position |
.pop |
Removes the element at the specified position |
.remove |
Removes the first item with the specified value |
.reverse |
Reverses the order of the list |
.sort |
Sorts the list |
list methods code examples |
Description |
list.append=> |
An example for using append |
list.clear=> |
An example for using clear |
list.copy=> |
An example for using copy |
list.count=> |
An example for using count |
list.extend=> |
An example for using extend |
list.index=> |
An example for using index |
list.insert=> |
An example for using insert |
list.pop=> |
An example for using pop |
list.remove=> |
An example for using remove |
list.reverse=> |
An example for using reverse |
list.sort=> |
An example for using sort |
list.comp=>_1 |
An example for using list comprehension |
list.comp=>_2 |
An example for using list comprehension |
list.comp=>_3 |
An example for using list comprehension |
list.comp=>_4 |
An example for using list comprehension |
list.comp=>_5 |
An example for using list comprehension |
sets methods code snippets |
Description |
.add |
Adds an element to the set |
.clear |
Removes all the elements from the set |
.copy |
Returns a copy of the set |
.difference |
Returns a set containing the difference between two or more sets |
.difference_update |
Removes the items in this set that are also included in another, specified set |
.discard |
Remove the specified item |
.intersection |
Returns a set, that is the intersection of two other sets |
.intersection_update |
Removes the items in this set that are not present in other, specified set(s) |
.isdisjoint |
Returns whether two sets have a intersection or not |
.issubset |
Returns whether another set contains this set or not |
.issuperset |
Returns whether this set contains another set or not |
.pop |
Removes the specified element |
.remove |
Removes the specified element |
.symmetric_difference |
Returns a set with the symmetric differences of two sets |
.symmetric_difference_update |
inserts the symmetric differences from this set and another |
.union |
Return a set containing the union of sets |
.update |
Update the set with the union of this set and others |
sets methods code examples |
Description |
sets.add=> |
An example for using add |
sets.clear=> |
An example for using clear |
sets.copy=> |
An example for using copy |
sets.difference=>_1 |
An example for using difference |
sets.difference=>_2 |
An example for using difference |
sets.difference_update=> |
An example for using difference_update |
sets.discard=> |
An example for using discard |
sets.intersection=>_1 |
An example for using intersection |
sets.intersection=>_2 |
An example for using intersection |
sets.intersection_update=>_1 |
An example for using intersection_update |
sets.intersection_update=>_2 |
An example for using intersection_update |
sets.isdisjoint=>_1 |
An example for using isdisjoint |
sets.isdisjoint=>_2 |
An example for using isdisjoint |
sets.sets.issubset=>_1 |
An example for using issubset |
sets.issubset=>_2 |
An example for using issubset |
sets.issuperset=>_1 |
An example for using issuperset |
sets.issuperset=>_2 |
An example for using issuperset |
sets.pop=> |
An example for using pop |
sets.remove=> |
An example for using remove |
sets.symmetric_difference=> |
An example for using symmetric_difference |
sets.symmetric_difference_update=> |
An example for using symmetric_difference_update |
sets.union=>_1 |
An example for using union |
sets.union=>_2 |
An example for using union |
sets.update=> |
An example for using update |
dictionary methods code snippets |
Description |
.clear |
Removes all the elements from the dictionary |
.copy |
Returns a copy of the dictionary |
.fromkeys |
Returns a dictionary with the specified keys and values |
.get |
Returns the value of the specified key |
.items |
Returns a list containing the a tuple for each key value pair |
.keys |
Returns a list containing the dictionary's keys |
.pop |
Removes the element with the specified key |
.popitem |
Removes the last inserted key-value pai |
.setdefault |
Returns the value of the specified key. If the key does not exist: insert the key, with the specified value |
.update |
Updates the dictionary with the specified key-value pairs |
.values |
Returns a list of all the values in the dictionary |
dictionary methods code examples |
Description |
dictionary.clear=> |
An example for using clear |
dictionary.copy=> |
An example for using copy |
dictionary.fromkeys=> |
An example for using fromkeys |
dictionary.get=> |
An example for using get |
dictionary.items=> |
An example for using items |
dictionary.keys=> |
An example for using keys |
dictionary.pop=> |
An example for using pop |
dictionary.popitem=> |
An example for using popitem |
dictionary.setdefault=> |
An example for using setdefault |
dictionary.update=> |
An example for using update |
dictionary.values=> |
An example for using values |
tuple methods code snippets |
Description |
.count |
Returns the number of times a specified value occurs in a tuple |
.index |
Searches the tuple for a specified value and returns the position of where it was found |
tuple methods code examples |
Description |
tuple.count=> |
An example for using count |
tuple.index=> |
An example for using index |
for loop code examples |
|
for=> |
An example for using for |
for=>through_a_string |
An example for using for |
for=>break_statement |
An example for using for |
for=>continue_statement |
An example for using for |
for=>range_function_1 |
An example for using for |
for=>range_function_2 |
An example for using for |
for=>range_function_3 |
An example for using for |
for=>for_else |
An example for using for |
for=>for_else |
An example for using for |
while loop code snippets |
Description |
while |
while Statements |
while_els |
while Statements |
while loop code examples |
Description |
while=> |
while Statements |
while=>break_statement |
while Statements |
while=>continue_statement |
while Statements |
if/else statement code snippets |
Description |
if |
if Statements |
ifelif |
if/else if Statements |
ifelifelse |
if/else if/else Statements |
ifelse |
if/else Statements |
ifshort |
ifshort Statements |
else |
else Statements |
class code snippets |
Description |
class=> |
python class |
init=> |
class init method |
iter=> |
class iter method |
next=> |
class next method |
class code examples |
Description |
class=>_1 |
oop inheritance example |
class=>inheritance_1 |
oop inheritance example |
class=>inheritance_2 |
oop inheritance example |
class=>with_attribute_1 |
class with attribute example |
class=>with_attribute_2 |
class with attribute example |
class=>with_attribute_3 |
class with attribute example |
class=>with_method_1 |
class with method example |
class=>with_method_2 |
class with method example |
class=>encapsulation |
class encapsulation example |
class=>polymorphism |
class polymorphism example |
import code snippets |
Description |
import=> |
import module |
List Comprehensions code snippets |
Description |
comp=> |
List Comprehensions |
List Comprehensions code examples |
Description |
list.comp=>_1 |
An example for using list comprehension |
list.comp=>_2 |
An example for using list comprehension |
list.comp=>_3 |
An example for using list comprehension |
list.comp=>_4 |
An example for using list comprehension |
list.comp=>_5 |
An example for using list comprehension |
lambda code examples |
Description |
lambda |
A lambda function can take any number of arguments, but can only have one expression. |
function code snippets |
Description |
def=> |
Defining Function |
def=>with_default_value |
Defining Function wqith default values |
function=> |
Defining Function |
file code examples |
Description |
file=>openFile |
open a file |
file=>openFileReadLine |
Read one line of the file |
file=>writeExistFile |
Write to an Existing File |
file=>writeOwerWrite |
Open a file and overwrite the content |
file=>createFileIfDoesNotExist |
Create a new file if it does not exist |
file=>createFile |
Create a new file |
file=>deleteFile |
delete a file |