{"id":8448,"date":"2021-11-18T22:53:14","date_gmt":"2021-11-19T03:53:14","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8448"},"modified":"2021-11-28T23:01:43","modified_gmt":"2021-11-29T04:01:43","slug":"python-list-joining","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8448","title":{"rendered":"Python List Joining"},"content":{"rendered":"<p>I&#8217;ve seen lists joined with a delimiter like this before:<\/p>\n<p>strDelimiter = &#8220;\\n&#8221;<br \/>\nstrDelimiter.join(listOfStuff)<\/p>\n<p>But it seems silly to allocate memory <em>just<\/em> for the delimiter &#8230; not a big deal from a resource perspective, and probably using the delimiter variable is more comprehensible in the future &#8230; but I&#8217;ve always wondered if you couldn&#8217;t just use a static string with the join method. Turns out you can &#8212;<\/p>\n<p>msgContent.attach(MIMEText(&#8220;\\n&#8221;.join(listOfStuff), &#8216;plain&#8217;))<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve seen lists joined with a delimiter like this before: strDelimiter = &#8220;\\n&#8221; strDelimiter.join(listOfStuff) But it seems silly to allocate memory just for the delimiter &#8230; not a big deal from a resource perspective, and probably using the delimiter variable is more comprehensible in the future &#8230; but I&#8217;ve always wondered if you couldn&#8217;t just &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[1503,664],"class_list":["post-8448","post","type-post","status-publish","format-standard","hentry","category-coding","tag-lists","tag-python"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8448"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8448\/revisions"}],"predecessor-version":[{"id":8449,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8448\/revisions\/8449"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}