Answer:
decode( )
Explanation:
We can use the method decode( ) to decode the string using the codec registered for encoding.
There are two parameters
encoding: We can encode with this parameter.
errors: If used to manage the errors.
For example:
String = "this is string example....wow!!!";
String = Str.encode('base64','strict');
If we print these variables we have:
String = b'dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE='
String = this is string example....wow!!!
Answer:
See explaination
Explanation:
def readFileFirstLast(filename):
# doc string
''' Function accept the filename and opens the fle
and reads all lines and strips new line character and
stores first and last in a string and return that string'''
#eception handle if file not found
try:
#opening the file
f = open(filename)
#reading the first line and striping the ne line
string = f.readline().strip()
#iterating until last line
for line in f:
pass
#concate the last line after strip the new line character to the string
string = string + " " + line.strip()
#return the string
return string
except:
#if file not found
return "File not found"
#taking the file name from user
filename = input("Enter a file name: ")
#printing the doc string in function
print("\ndoc_sting: \n"+ readFileFirstLast.__doc__+"\n")
#printing the returned string by calling the readFileFirstLast()
print("output string :")
print(readFileFirstLast(filename))
I agree with the programmers who think object-oriented programming is a superior approach to procedural programming.
<h3>Why is OOP better than procedural programming?</h3>
In terms of Security, Object-oriented programming is said to have more of a secure based than procedural programming, due to the level of abstraction or that is due to data hiding property.
Note that It hinders the access of data to any member functions of the same class and one cannot see a thing like that such as data hiding in the procedural programming framework.
Learn more about object-oriented programming from
brainly.com/question/12342989
#SPJ1