Python Functions

from collections import Counter
print(Counter('sasasaasdadasdasdasdadadadadadd'))

import re

f = open('file.txt','r')
print(f.read())
f.close()

import pandas as pd
data = pd.read_csv('data.csv')
print(data.to_string())
print(data.shape)
print(data.describe())
print(data.head())

import os
print(os.getcwd())
print(os.listdir())
os.mkdir("Hello")

import shutil
shutil.move('hi.txt','/content/Hello')

import send2trash as s2t
s2t.send2trash('Junk/welcome.txt')

import time

import datetime
print(datetime.datetime.now())

Learn

capitalize()

Converts the first character to upper case

text = "hello world"
result = text.capitalize()
print(result)  # Output: Hello world

casefold()

Converts string into lower case

text = "Hello World"
result = text.casefold()
print(result)  # Output: hello world

center()

Returns a centered string

text = "hello"
result = text.center(10, "*")
print(result)  # Output: **hello***

txt = 'hello'
print(txt.center(11,'-'))
#Output: ---hello---

count()

Returns the number of times a specified value occurs in a string

text = "apple"
result = text.count("p")
print(result)  # Output: 2

center()