목록문자열변환 (2)
스택큐힙리스트
이 질문은 이미 답변이 있습니다: Convert bytes to a string(22개의 답변)21일 전에 마감되었습니다.예를 들어, subprocess.check_output의 반환 값처럼 이러한 문자열이 있습니다. >>> b'a string'b'a string'내가 무슨 조작을 해도 그 문자열 앞에 항상 지저분한 b' 가 출력돼. >>> print(b'a string')b'a string'>>> print(str(b'a string'))b'a string'일반 문자열로 사용하거나 일반 문자열로 변환하는 방법에 대한 아이디어가 있는 사람이 있나요?답변 1해독해주세요. >>> b'a string'.decode('ascii')'a string'문자열에서 바이트를 가져 오려면 인코딩하십시오. >>> 'a s..
C#에서 int을 enum으로 변환하는 방법은 무엇인가요?답변 1정수에서: YourEnum foo = (YourEnum)yourInt;문자열로부터: YourEnum foo = (YourEnum) Enum.Parse(typeof(YourEnum), yourString);// The foo.ToString().Contains(,) check is necessary for // enumerations marked with a [Flags] attribute.if (!Enum.IsDefined(typeof(YourEnum), foo) && !foo.ToString().Contains(,)){ throw new InvalidOperationException( ${yourString} is not an underl..