본문 바로가기

Google3

Python 파이썬에서 상위 디렉토리를 어떻게 얻을 수 있나요?, How do I get the parent directory in Python? 질문 누군가가 Python에서 경로의 상위 디렉토리를 크로스 플랫폼 방식으로 얻는 방법에 대해 알려주실 수 있을까요? 예시: C:\Program Files ---> C:\ 그리고 C:\ ---> C:\ 만약 디렉토리에 상위 디렉토리가 없다면, 디렉토리 자체를 반환합니다. 이 질문은 간단해 보일 수 있지만, 구글에서 찾아내지 못했습니다. 답변 파이썬 3.4 pathlib 모듈을 사용하세요. from pathlib import Path path = Path("/here/your/path/file.txt") print(path.parent.absolute()) 이전 답변 다음을 시도해보세요: import os print os.path.abspath(os.path.join(yourpath, os.pardir)).. 2023. 10. 9.
Flutter 플러터에서 TextFormField의 입력 텍스트 색상을 변경하는 방법, How to change TextFormField input text color in Flutter 질문 대학에서 플러터 앱의 UI를 만들고 있습니다. TextFormField에 입력된 텍스트를 흰색으로 표시하고 싶습니다. 이는 불필요하게 어렵습니다. 구글링 등을 시도해 보았지만 명확한 답변을 찾을 수 없습니다. new Theme( // 이는 밑줄의 색상을 지정합니다 data: theme.copyWith( primaryColor: Colors.white, hintColor: Colors.transparent, ), child: new Padding( padding: const EdgeInsets.fromLTRB(32.0, 40.0, 32.0, 4.0), child: TextFormField( key: Key('username'), keyboardType: TextInputType.text, contro.. 2023. 9. 29.
Flutter에서 Column에 ListView를 추가하는 방법은 무엇인가요?, How to add a ListView to a Column in Flutter? 질문 Flutter 앱을 위한 간단한 로그인 페이지를 만들려고합니다. TextFields와 로그인 / 가입 버튼을 성공적으로 만들었습니다. 가로 ListView를 추가하려고합니다. 코드를 실행하면 요소가 사라지지만 ListView없이 수행하면 다시 정상입니다. 올바르게 어떻게 할 수 있을까요? return new MaterialApp( home: new Scaffold( appBar: new AppBar( title: new Text("로그인 / 가입"), ), body: new Container( child: new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: [ new TextField( decora.. 2023. 5. 8.