Posts

Beautiful soup in python

Hi there! Beautiful Soup  is a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree. It commonly saves programmers hours or days of work. These instructions illustrate all major features of Beautiful Soup 4, with examples. I show you what the library is good for, how it works, how to use it, how to make it do what you want, and what to do when it violates your expectations. The examples in this documentation should work the same way in Python 2.7 and Python 3.2. You might be looking for the documentation for  Beautiful Soup 3 . If so, you should know that Beautiful Soup 3 is no longer being developed and that support for it will be dropped on or after December 31, 2020. If you want to learn about the differences between Beautiful Soup 3 and Beautiful Soup 4, see  Porting code to BS4 .

Pyaudio library in python

Hi readers! It is a library of python used to discover audio files for a project by giving input by client. so that user can give voice as an input. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple Mac OS X.

Implenting the voice cmd on my project

Hi There! Today I am going to provide voice input to my project and that will done by the help of python library, as we know that python is having lots of library. So today I will be showing the client some features of my project. Pyalaudio and pyaudio library is helping out me for my voice input.

What is Alexa is!

Hi Readers! You’ve probably heard the name “Alexa.” You know, the name you call out when you want to interact with Amazon’s virtual assistant? Well, provided you own an Echo or some other Alexa-enabled device. Amazon’s assistant is a female voice that talks to you in a conversational manner, ready to help you with many tasks. She has been integrated into several of the company’s products and is starting to find her way into third-party devices, like  GE lamps  and the  Sonos One speaker . Amazon is also starting to put Alexa into  wearables , headphones, and all sorts of other gadgets. Alexa can perform a variety of simple tasks, like playing music, but you can also use Alexa in your smart home to dim the lights, lock the doors, adjust the thermostat, and control other smart home devices.

Python - Exceptions Handling

Hi there! Python provides two very important features to handle any unexpected error in your Python programs and to add debugging capabilities in them − Exception Handling  − This would be covered in this tutorial. Here is a list standard Exceptions available in Python:  Standard Exceptions . Assertions  − This would be covered in  Assertions in Python  tutorial. List of Standard Exceptions − Sr.No. Exception Name & Description 1 Exception Base class for all exceptions 2 StopIteration Raised when the next() method of an iterator does not point to any object. 3 SystemExit Raised by the sys.exit() function. 4 StandardError Base class for all built-in exceptions except StopIteration and SystemExit. 5 ArithmeticError Base class for all errors that occur for numeric calculation. 6 OverflowError Raised when a calculation exceeds maximum limit for a numeric type. 7 FloatingPointError Raised when a floating point calculation fails.

Variable-length arguments in python

You may need to process a function for more arguments than you specified while defining the function. These arguments are called  variable-length  arguments and are not named in the function definition, unlike required and default arguments. Syntax for a function with non-keyword variable arguments is this − def functionname([formal_args,] *var_args_tuple ): "function_docstring" function_suite return [expression] An asterisk (*) is placed before the variable name that holds the values of all nonkeyword variable arguments. This tuple remains empty if no additional arguments are specified during the function call. Following is a simple example − Live Demo #!/usr/bin/python # Function definition is here def printinfo ( arg1 , * vartuple ): "This prints a variable passed arguments" print "Output is: " print arg1 for var in vartuple : print var return ; # Now you can call printinfo function printinfo (

Pass by reference vs value

All parameters (arguments) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function. For example − Live Demo #!/usr/bin/python # Function definition is here def changeme ( mylist ): "This changes a passed list into this function" mylist . append ([ 1 , 2 , 3 , 4 ]); print "Values inside the function: " , mylist return # Now you can call changeme function mylist = [ 10 , 20 , 30 ]; changeme ( mylist ); print "Values outside the function: " , mylist Here, we are maintaining reference of the passed object and appending values in the same object. So, this would produce the following result − Values inside the function: [10, 20, 30, [1, 2, 3, 4]] Values outside the function: [10, 20, 30, [1, 2, 3, 4]]