This is the python code used to generate word cloud for all the recent tweets by Narendra Modi G. Follow this code to generate yours word cloud for specific person In [11]: #import modules for api import tweepy from tweepy import OAuthHandler import os In [2]: consumer_key = "---------------------------" consumer_secret_key = "------------------------------------------------" access_token = "------------------------------------------------" access_secret = … Continue reading WordCloud-of-tweets-by-@narendramodi
Category: PYTHON
Remove Space in Python – (strip Leading, Trailing, Duplicate spaces in string)
"Learn everyday to grow everyday" In this tutorial we will study about rstrip, lstrip, strip, replace and regular expression to Remove (strip) space at the start of the string in Python Remove (strip) space at the end of the string in Python Remove (strip) white spaces from start and end of the string. Remove all … Continue reading Remove Space in Python – (strip Leading, Trailing, Duplicate spaces in string)
.strip() , .replace() and findAll()
Today's topic is .replace(), .strip() and findAll() *****Learn everyday to grow everyday***** This three are very useful function for beginners and for web scrapers while they are scraping a webpage. .strip() .strip() is used to remove white space from the start and end of the string. ## .rstrip() and .lstrip() .rstrip() is used … Continue reading .strip() , .replace() and findAll()
Daily Practice Questions(PYTHON)
Q: Write a program using class methods to accept coordinates as a pair of tuples and return the slope and distance of the line. Q: Scrap website's all h1 tag text , split with white space and store them in a list and print the list . Q: Scrap meta tag with name keywords from … Continue reading Daily Practice Questions(PYTHON)
WEB SCRAPING(scrap h1 tag from list of urls)
For detailed explanation and code click here - https://github.com/theone9807/Webscraping-scrap-h1-tag-from-list-of-urls- #made a web scrapper which scrapped H1 from a page . #And it is able to scrap from a list of urls and save it in a data frame. In [1]: import pandas as pd df = pd.read_excel('test.xlsx', sheetname=0) # can also index sheet by name … Continue reading WEB SCRAPING(scrap h1 tag from list of urls)
Booleans in Python(Comparison operators)
For the following quiz questions, we will get a preview of comparison operators. In the table below, a=3 and b=4. Operator Description Example == If the values of two operands are equal, then the condition becomes true. (a == b) is not true. != If values of two operands are not equal, then condition becomes … Continue reading Booleans in Python(Comparison operators)
enumerate() function in python
There are many situations where we'll need to iterate over multiple lists in tandem, such as this one: In the example above, we have two lists. The second list describes the viciousness of the animals in the first list. A Dog has a viciousness level of 1, and a SuperLion has a viciousness level of 10. We want to retrieve the position of the item in animals the loop … Continue reading enumerate() function in python
for loop in python
A for loop is used for iterating over sequence(i.e. a list, tuple, dictionary, set, string). Syntax of for Loop: The for loop used in python is different from the for keyword used in other programming languages, and work more like iterator as found in other object-oriented programming languages. Example: >Even strings are iterable objects, they … Continue reading for loop in python
Python lambda (Anonymous Functions)
In python, a function without name is known as anonymous function. As we know that def keyword is used to define a normal function, but to define anonymous function lambda keyword is used to create an anonymous function. Lambda functions can take any number of arguments but only one expression, which is evaluated and returned. … Continue reading Python lambda (Anonymous Functions)
VARIABLES IN PYTHON
Unlike other programming language, Declaring variable in python is very easy, In python variable is created at the moment you assign a value to it. And variable can be of any data type. Example: Variable can be of any data type. Rules for Variable Names A variable can have a short name (like x and … Continue reading VARIABLES IN PYTHON



