私信  •  关注

Taohidul Islam

Taohidul Islam 最近创建的主题
Taohidul Islam 最近回复了
6 年前
回复了 Taohidul Islam 创建的主题 » 如何在python中从列表中获取字符串值

将类型转换为 str :

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

result = str(result[0].get('start_date']))
6 年前
回复了 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]
6 年前
回复了 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)