We've been learning about sequences in Python but now we're going to switch gears and learn about mappings in Python. If you're familiar with other languages you can think of these Dictionaries as hash tables. This section will serve as a brief introduction to dictionaries and consist of: 1.) Constructing a Dictionary 2.) Accessing objects … Continue reading Dictionaries in Python
Lists in Python
Earlier when discussing strings we introduced the concept of a sequence in Python. Lists can be thought of the most general version of a sequence in Python. Unlike strings, they are mutable, meaning the elements inside a list can be changed! In this section we will learn about: 1.) Creating lists 2.) Indexing and Slicing … Continue reading Lists in Python
String Formatting
String formatting lets you inject items into a string rather than trying to chain items together using commas or string concatenation. As a quick comparison, consider: player = 'Thomas' points = 33 'Last night, '+player+' scored '+str(points)+' points.' # concatenation f'Last night, {player} scored {points} points.' # string formatting There are three ways to perform … Continue reading String Formatting
Strings
Strings are used in Python to record text information, such as names. Strings in Python are actually a sequence, which basically means Python keeps track of every element in the string as a sequence. For example, Python understands the string "hello' to be a sequence of letters in a specific order. This means we will … Continue reading Strings
Variable Assignment
Rules for variable names names can not start with a number names can not contain spaces, use _ intead names can not contain any of these symbols: :'",<>/?|\!@#%^&*~-+ it's considered best practice (PEP8) that names are lowercase with underscores avoid using Python built-in keywords like list and str avoid using the single characters l (lowercase … Continue reading Variable Assignment
Numbers and more in Python
In this tutorial, we will learn about numbers in Python and how to use them. We'll learn about the following topics: 1.) Types of Numbers in Python 2.) Basic Arithmetic 3.) Differences between classic division and floor division 4.) Object Assignment in Python Types of numbers Python has various "types" of numbers (numeric literals). We'll … Continue reading Numbers and more in 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)
