Integer Check
title: "Integer Check"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
text = "one 2 three 4 five 6 seven 8 nine 10"
for x in text.split(" "):
print(x, "==>", x.isdigit())
one ==> False
2 ==> True …
Read More
Integer Check Temp
title: "Integer Check Temp"
author: "Rj"
date: 2019-05-20
description: "Integer Check"
type: technical_note
draft: false
text = "one 2 three 4 five 6 seven 8 nine 10"
for x in text.split(" "):
print(x, "==>", x.isdigit())
Read More
Ip Whois
title: "IP Whois Simple"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from ipwhois import IPWhois
from pprint import pprint
obj = IPWhois('133.1.2.5')
results = obj.lookup_whois(inc_nir=True)
pprint(results)
{'asn': '4730',
'asn_cidr': '133.1.0.0/16',
'asn_country_code': 'JP',
'asn_date': '1997-03-01',
'asn_description': 'ODINS …
Read More
Ip2Long
title: "IP To Long"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
class AuthException(Exception):
pass
def ip_to_long(ip_address):
'''
'''
if(ip_address == '0:0:0:0:0:0:0:1'):
ip_address = '127.0.0.1'
ip_address_array = ip_address.split('.')
if(len(ip_address_array) != 4):
raise AuthException('Invalid Ip …
Read More
Item-In-List
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: ml311; pyv: 3.11.10 (main, Oct 3 2024, 07:29:13) [GCC 11.2.0]'
print(pyu.ps2("haystack-ai ollama-haystack python-dotenv"))
haystack-ai==2.8.0
ollama-haystack is not installed in the current environment.
python-dotenv==0.21.0
model_cache = {
"test1.joblib" : {"one …
Read More
Itertool Chain
title: "Itertool Chain"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
from itertools import chain
string = 'Toronto'
chain(string)
<itertools.chain at 0x108ed2ba8>
<itertools.chain at 0x108ed2b70>
Read More
Json-To-Xml
title: "JSON to XML"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
content = {
"note" : {
"to" : "Tove",
"from" : "Jani",
"heading" : "Reminder",
"body" : "Don't forget me this weekend!"
}
}
{'note': {'body': "Don't forget me this weekend!",
'from': 'Jani',
'heading': 'Reminder',
'to': 'Tove'}}
xml = xmltodict.unparse …
Read More
Lambda-Custom
title: "Lambda Custom"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
cities = [
'chennai', 'delhi', 'madurai', 'pune', 'bengaluru'
]
['chennai', 'delhi', 'madurai', 'pune', 'bengaluru']
def is_south_indian_city(city):
if city == 'chennai' or city == 'madurai' or city == 'bengaluru':
return True
return False
new_list = list(filter(lambda x: is_south_indian_city(x) , cities …
Read More
Lambda-Odd
title: "Lambda Odd"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
def is_odd(digit):
if digit % 2 != 0:
return True
return False
digits = [
1, 7, 18, 2, 4, 2, 8, 5, 3
]
[1, 7, 18, 2, 4, 2, 8, 5, 3]
new_list = list(filter(lambda x …
Read More
Lambda-Sqaure
title: "Lambda Square"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
squares = list(map(lambda x: x**2, range(10)))
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Score: 0
Read More