Python String decode() Method - Tutorialspoint
文章推薦指數: 80 %
Description. Python string method decode() decodes the string using the codec registered for encoding. It defaults to the default string encoding. Home CodingGround Jobs Whiteboard Tools Business Teachwithus PythonBasicTutorial Python-Home Python-Overview Python-EnvironmentSetup Python-BasicSyntax Python-VariableTypes Python-BasicOperators Python-DecisionMaking Python-Loops Python-Numbers Python-Strings Python-Lists Python-Tuples Python-Dictionary Python-Date&Time Python-Functions Python-Modules Python-FilesI/O Python-Exceptions PythonAdvancedTutorial Python-Classes/Objects Python-RegExpressions Python-CGIProgramming Python-DatabaseAccess Python-Networking Python-SendingEmail Python-Multithreading Python-XMLProcessing Python-GUIProgramming Python-FurtherExtensions PythonUsefulResources Python-QuestionsandAnswers Python-QuickGuide Python-Tools/Utilities Python-UsefulResources Python-Discussion SelectedReading UPSCIASExamsNotes Developer'sBestPractices QuestionsandAnswers EffectiveResumeWriting HRInterviewQuestions ComputerGlossary WhoisWho PythonStringdecode()Method Advertisements PreviousPage NextPage BeyondBasicProgramming-IntermediatePython MostPopular 36Lectures 3hours MohammadNauman MoreDetail PracticalMachineLearningusingPython BestSeller 91Lectures 23.5hours MANASDASGUPTA MoreDetail PracticalDataScienceusingPython 22Lectures 6hours MANASDASGUPTA MoreDetail Description Pythonstringmethoddecode()decodesthestringusingthecodecregisteredforencoding.Itdefaultstothedefaultstringencoding. Syntax Str.decode(encoding='UTF-8',errors='strict') Parameters encoding−Thisistheencodingstobeused.Foralistofallencodingschemespleasevisit:StandardEncodings. errors−Thismaybegiventosetadifferenterrorhandlingscheme.Thedefaultforerrorsis'strict',meaningthatencodingerrorsraiseaUnicodeError.Otherpossiblevaluesare'ignore','replace','xmlcharrefreplace','backslashreplace'andanyothernameregisteredviacodecs.register_error(). ReturnValue Decodedstring. Example LiveDemo #!/usr/bin/python Str="thisisstringexample....wow!!!"; Str=Str.encode('base64','strict'); print"EncodedString:"+Str print"DecodedString:"+Str.decode('base64','strict') Result EncodedString:dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE= DecodedString:thisisstringexample....wow!!! python_strings.htm PreviousPage PrintPage NextPage Advertisements
延伸文章資訊
- 1Python String decode() Method - Tutorialspoint
Description. Python string method decode() decodes the string using the codec registered for enco...
- 2Python Strings decode() method - GeeksforGeeks
decode() is a method specified in Strings in Python 2. This method is used to convert from one en...
- 3decode - Python Reference (The Right Way) - Read the Docs
Syntax¶. str. decode([encoding[, errors]]). encoding: Optional. The desired encoding. Defaults to...
- 4Python decode()方法 - 極客書
decode()方法使用注冊編碼的編解碼器的字符串進行解碼。它默認為默認的字符串編碼。 語法以下是decode()方法的語法: str . decode ( encoding = UTF-8 ,...
- 5codecs — Codec registry and base classes — Python 3.10.7 ...
This module defines base classes for standard Python codecs (encoders and decoders) and ... Custo...