Skip to content

Instantly share code, notes, and snippets.

View CodersArts's full-sized avatar
💭
Computer Science Assignment Portal.We offers programming assignment.

CodersArts CodersArts

💭
Computer Science Assignment Portal.We offers programming assignment.
View GitHub Profile
@CodersArts
CodersArts / compile.py
Created August 26, 2019 15:21
compile regular expression
import re
pattern=re.compile('my')
result=pattern.findall('my name is naveen')
print result
result2=pattern.findall('Hi Hi This is codersarts')
print result2
Output
['my']
@CodersArts
CodersArts / split.py
Created August 26, 2019 15:22
split() regular expression in python
import re
s = "HELLO there HOW are YOU"
l = re.compile("(?<!^)\s+(?=[A-Z])(?!.\s)").split(s)
print l
Output:
['HELLO there', 'HOW are', 'YOU']
@CodersArts
CodersArts / sub.py
Created August 26, 2019 15:25
sub() regular expression in python
import re
text = "Python for beginner is a very cool website"
pattern = re.sub("cool", "good", text)
print text2
@CodersArts
CodersArts / subn.py
Created August 26, 2019 15:27
subn() regular expression syntax
re.subn (pattern, repl, string, count=0, flags=0)
@CodersArts
CodersArts / escape.py
Created August 26, 2019 15:30
escape() regular expression in python
import re
print re.escape("Hello 123 .?!@ World")
output:
Hello\ 123\ \.\?\!\@\ World
@CodersArts
CodersArts / search.py
Created August 26, 2019 15:31
search() regular expression in python
import re
m = re.search('(?<=abc)def', 'abcdef')
m.group(0)
Output:
'def'
@CodersArts
CodersArts / match.py
Created August 26, 2019 15:32
match() regular expression in python
import re
value = "voorheesville"
m = re.match("(vi.*)", value)
if m:
print("match:", m.group(1))
Output
@CodersArts
CodersArts / findall.py
Created August 26, 2019 15:33
findall() regular expression in python
import re
regex = ur"\[P\] (.+?) \[/P\]+?"
line = "President [P] Barack Obama [/P] met Microsoft founder [P] Bill Gates [/P], yesterday."
person = re.findall(regex, line)
print(person)
@CodersArts
CodersArts / HotalManagementGUI.py
Created August 27, 2019 19:40
Hotel Management GUI app using tkinter
from tkinter import *
from tkinter import ttk
import time
import datetime
from PIL import ImageTk,Image
import os
import sqlite3
from tkinter import messagebox
@CodersArts
CodersArts / 2D_array_numpy.py
Created September 5, 2019 06:10
Creating 2D array using list of list using python numpy
#Codersarts by NK
import numpy as np
li = [[1,2,3], [5,6,7], [6,7,8]]
nparray = np.array(list2)
nparray