社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Taohidul Islam  »  全部回复
回复总数  3
7 年前
回复了 Taohidul Islam 创建的主题 » 如何在python中从列表中获取字符串值

将类型转换为 str :

result = str(result[0]['start_date'])

或

result = str(result[0].get('start_date']))
7 年前
回复了 Taohidul Islam 创建的主题 » 如何在python中从列表中获取值[closed]

试试这个:

result = [{'start_date': datetime.date(2019, 1, 20)}, {'start_date': datetime.date(2019, 1, 21)}, {'start_date': datetime.date(2019, 1, 22)}]
result_list = [str(i.get("start_date")) for i in result]
8 年前
回复了 Taohidul Islam 创建的主题 » 如何在python中删除字符串中的某些空格?[副本]

试试这个:

s = """subject: Exercise Feedback Form
persona_id: bresse
Q1: Yes
Q1 comments: Yes everything was found A1
Q2: No
Q2 comments: No forgot to email me A2
Q3: Yes
Q3 comments: All was good A3
Q4: No
Q4 comments: It was terrible A4
Q5_comments: Get Alex to make it better






























subject: Issue With App
persona_id: bresse
comments: Facebook does not work comments feedback"""
s = s.replace("\n\n","")
print(s)