Codegyan has Published 20 Answers

How To Send mail from your Gmail account using Python

Updated on 22-Nov-2021 22:09:23

Here, we are going to learn how to send a simple basic mail using Python code. Python, being a powerful language don’t need any external library to import and offers a native library to send emails- “SMTP lib”. “smtplib” creates a Simple Mail Transfer Protocol client session object which is used to send emails to any valid email id on the internet. Different websites use different port numbers. In this article, we are using a Gmail account to send a mail. Port number used here is �... Read More

Accept Credit Cards Online with an Merchant Account!

Updated on 01-Nov-2021 9:17:20

If you want to accept credit cards online, you will need to set up a credit card merchant account with a reputable firm. There are a lot of merchant account providers out there, however, Codegyan has teamed up with e-onlinedata to make it easy for our customers to obtain merchant accounts and use the Authorize.net gateway. Authorize.net will integrate into the shopping carts that we provide, such as OSCommerce, CubeCart, WHMCS, etc. The offer we’ve got for our customers is someth... Read More

How to get a list of parameter names inside Python function?

Updated on 30-Oct-2021 13:44:28

To extract the number and names of the arguments from a function or function[something] to return ("arg1", "arg2"), we use the inspect module. The given code is written as follows using inspect module to find the parameters inside the functions aMethod and foo. Example import inspect def aMethod(arg1, arg2): pass print(inspect.getargspec(aMethod)) def foo(a,b,c=4, *arglist, **keywords): pass print(inspect.getargspec(foo))  Output ArgSpec(args=['arg1', 'arg2'], varargs=None, keywo... Read More

How to redirect HTTP to HTTPS Using htaccess

Updated on 14-Oct-2021 13:50:16

Chrome and Firefox have started showing insecure warnings on sites without SSL certificates. Without SSL, your website will show insecure to the visitors. Therefore, using an SSL-encrypted connection for safety, accessibility or PCI compliance reasons is necessary. It becomes very important to redirect from HTTP to HTTPS. What is SSL? SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted links between a web server and a browser in an online communication. ... Read More

How to make a chain of function decorators in Python?

Updated on 30-Jan-2023 19:39:21

Decorators are “wrappers”, which allow us to execute code before and after the function they decorate without modifying the function itself. Example The given code can be wrapped in a chain of decorators as follows. def makebold(fn): def wrapped(): return "" + fn() + "" return wrapped def makeitalic(fn): def wrapped(): return "" + fn() + "" return wrapped @makebold @makeitalic def hello(): return "hello world" print hello() Output C:/Users/codegyan/~.py hel... Read More

What are Python function attributes?

Updated on 03-Oct-2021 13:29:18

Everything in Python is an object, and almost everything has attributes and methods. In python, functions too are objects. So they have attributes like other objects. All functions have a built-in attribute __doc__, which returns the doc string defined in the function source code. We can also assign new attributes to them, as well as retrieve the values of those attributes. For handling attributes, Python provides us with “getattr” and “setattr”, a function that takes three arguments.... Read More

Why is iOS better than Android ?

Updated on 27-Sep-2021 15:48:28

Why is iOS better than Android? We can't deny that Android is the most used platform worldwide. However, there are various reasons that recommend that iOS phones perform better than Android. Apple has shown how Software and hardware complement each other with the recent releases of iPhones, i.e., iPhone 12, iPhone 11, iPhone 11 pro max, iPhone XR, etc. Apple has also worked seamlessly on other gadgets like Macs, Apple Watch, and Apple TV. It not only provides a device; it provides a closed e... Read More

Top 50 Programming Interview Questions & Answers (2021)

Updated on 27-Sep-2021 15:34:46

1) What is Computer programming? Computer Programming is also known as programming or coding. Programming is a process which includes processes such as coding, maintaining, updating, debugging, writing, designing (algorithm), etc. 2) How does programming work? Programming contains a set of instructions for the computer to perform different tasks. In fact, those instructions are executable commands, each having a different purpose. 3) What is debugging? Debugging is the process of ... Read More

How to print page using JavaScript ?

Updated on 26-Sep-2021 19:21:08

To print a page in JavaScript, use the print() method. It opens up the standard dialog box, through which you can easily set the printing options like which printer to select for printing. Page print in JavaScript is a simple code in JS used to print the content of the web pages. The print() method prints the contents of the current window.(window.print) It basically opens Print dialog box which lets you choose between various printing options. Syntax: window.print() Parameters... Read More

How to create accordion on blogger using HTML & JavaScript ?

Updated on 25-Sep-2021 1:02:18

Create accordion using html & javascript on blogger. Its too much easy to create accordion using html & javascript .  Below is the code by using you create an accordion on blogger using html & javascript. HTML <button class="acc">Show Answer</button> <div class="pnl"> <p></p> </div> CSS .acc { background-color: #eee; color: #444; cursor: pointer; padding: 18px; width: 100%; border: none; text-align: left; ... Read More

Advertisements

ads