如何解决使用Python pathlib获取没有文件名的文件的绝对路径
我要替换file_location = os.path.abspath(os.path.dirname(__file__))
与pathlib
一起使用,以获取不带文件名的文件的最佳路径
使用directorypath = pathlib.Path(__file__).resolve()
给我绝对路径+文件名
如何在没有文件名的情况下获取绝对路径?
解决方法
您可以使用'.parent': TextField(
onChanged: (newValue) {
if (newValue.length > 5) { // test for your condition
setState(() {
_color = Colors.red; // change the color
});
} else {
setState(() {
_color = Colors.blue; // change the color if the condition is not met
});
}
},),
Path.parent
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。