THE DFIR BLOG
Menu

Incident Response Forensics

Python Data Type

3/16/2018

 
Numbers
Integer = Number
Float = Decimal Number

Code Example:
Integer:
answer = 42
Float:
pi = 3.14159
Complex Number (Python 3):

Easy TypeCast
int(pi) == 3
float(answer) == 42.0

String:
Python 2: ASCII
Python 3: Unicode
String Can be defined using:
'Jello World' = "Jello World" = """Jello World """
Example:
"hello.capatalize() == "Hello"
"hello".replace("e" , "a") == "Hallo"
"hello".isalpha() == True
"123".isdigit()== True #Useful when converting to Int
Advanced
"Some, csv, values".split(",") = ["some","csv","values"]


String Format
name = "PythonGo"
Machine = 'BAL"

"Great meeting you {0}. I am {1}".format(name,machine)

Python 3.6
String Interpolation:
f"Great meeting you {name}. I am {machine}


Boolean and None:

python_book = True
java_book = False

Used often with If Statement
Note - Both Start with Capital Letter T and Capital F

int(python_book) == 1
int(java_book)==0
ste(python_book) == "True"

aliens_found= None






Comments are closed.

    Archives

    April 2020
    September 2019
    August 2019
    July 2019
    June 2019
    April 2019
    February 2019
    March 2018

    Categories

    All
    Aws
    Cloud
    Dfir
    Incident Response
    Linux
    Recon

    RSS Feed

  • Infosec
  • Mac Forensics
  • Windows Forensics
  • Linux Forensics
  • Memory Forensics
  • Incident Response
  • Blog
  • About Me
  • Infosec
  • Mac Forensics
  • Windows Forensics
  • Linux Forensics
  • Memory Forensics
  • Incident Response
  • Blog
  • About Me