Category Archives: Python

Print a String 3 Times

str1=”Welcome” print(str1*3)

Posted in Python, Uncategorized | Leave a comment

Get Memory Address Python

”’ Created on Jun 14, 2017 @author: asharda ”’ str1=”Welcome” print(id(str1))

Posted in Python, Uncategorized | Leave a comment

Find the Numerical Type Python

”’ Created on Jun 14, 2017 @author: asharda ”’ x=89.28 print(type(x))

Posted in Python, Uncategorized | Leave a comment

API Python Detail

”’ Created on Jun 6, 2017 @author: asharda ”’ import requests resp = requests.get(“http://api.open-notify.org/iss-now.json”) print(resp.status_code) data=resp.json() print(type(data)) print(data) if resp.status_code != 200: # This means something went wrong. raise Exception(‘GET /tasks/ {}’.format(resp.status_code)) for todo_item in resp.json(): print(todo_item)  

Posted in Python, Uncategorized | Leave a comment

Working with API -Python

”’ Created on Jun 6, 2017 @author: asharda ”’ import requests resp = requests.get(“http://api.open-notify.org/iss-now.json”) print(resp.status_code) if resp.status_code != 200: # This means something went wrong. raise Exception(‘GET /tasks/ {}’.format(resp.status_code)) for todo_item in resp.json(): print(todo_item)  

Posted in Python, Uncategorized | Leave a comment

Try/Catch/Finally in Python

”’ Created on Jun 2, 2017 Using Try Except in Python @author: asharda ”’ import numpy as np def testException(level): try: if level<1 : raise Exception(level + ‘is invalid’) except : print(“In Exception”) finally: print(“In Finally”)

Posted in Python, Uncategorized | Leave a comment

Check for Digit and AlphaNumeric Characters in Python

”’ Created on Jun 1, 2017 @author: asharda ”’ s=”12345abc” print(s.isdigit()) t=”abc1″ print(t.isalnum())

Posted in Python, Uncategorized | Leave a comment