Let's get started learning about these methods by looking at ` isalnum()`, which returns True if all characters in the string are alphanumeric and there is at least one character,
The `isalpha()` string method will return True if all characters in the string are alphabetic and there is at least one character
Today I am going to show you how to create 7️⃣ different file types with #Python:
🐍 Text file
🐍 CSV
🐍 XML
🐍 JSON
🐍 Tar file
🐍 PDF
🐍 Excel
Join me for this fun 🧵👇
1️⃣ Creating a text file with #Python is a breeze! The recommended method is to use Python's `with` statement as it will automatically close the file for you
That means you can create a text file with TWO lines of code if you want to:
2️⃣ Creating a CSV file with #Python can be accomplished using the `csv` module
When using a class in #Python, you may notice that the first argument in all the class's methods is "self"
What is up with that? Well, let's talk about it!
🧵👇🐍
First of all, "self" is a convention that refers to the instance that is created when you instantiate a class. You don't have to name it "self", but that is best practice
Here is an example where "self" is replaced with "this"
You use "self" to be able to access instance attributes across methods in a #Python class.
Here is an example where you initialize (__init__) `self.name` and then use `https://t.co/O7h9e3XIVz` later on when you call the `walk()` method: