Py4E DB Flashcards
Name 4 different charactersets, what in short are their differences, and name which one is most commonly used
ASCII (128 chars), UTF32, UTF16, UTF8-most commonly used. UTF32 uses 4 bytes, UTF16 2 bytes, UTF8 only 1 byte - reason why it’s used
which char.set is used internally by Python 3?
is there anything not being stored in that char.set?
Unicode
binary charset, own defined: ]] y = b’aaa’
With what function can you find the ASCII-number for a character?
]] ord( ‘a’ )
]] print( ord( ‘a’ ) )
What function is used to convert characters from outside sources?
And what does it do?
]] mystring = outside_db.recfv(512)
]] mystring.decode()
- it will move the data from byte to unicode
how to make a string into bytes?
]] < string >.encode()
from string of characters into bytes
in which direction are the 2 functions used?
decode() - data received
encode() - data sent
what is a class?
A family of a specific kind of objects sharing the same attributes
how can you list all functions available to a class?
]] L = list(), ]] D = dict(), ]] T = tuple()
]] dict(L), ]] dict(D), ]] dict(T)
Obj.prog.: what is a constructor?
An object at the time when initially constructed
What are the definitions for: Class, Method or Message, Field or Attribute, Object or Instance
Class - a template,
Method or Message - defined Class’ capability,
Field or Attribute - bit of data in a Class,
Object or Instance - an instance of a Class