<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alex Mercer</title>
    <description>The latest articles on DEV Community by Alex Mercer (@alex_mercer_321994).</description>
    <link>https://dev.to/alex_mercer_321994</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4253974%2F81d7a225-58d7-4168-a0ec-c0f712590a3e.png</url>
      <title>DEV Community: Alex Mercer</title>
      <link>https://dev.to/alex_mercer_321994</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex_mercer_321994"/>
    <language>en</language>
    <item>
      <title>3 Quick Python One-Liners That Save Me Time Every Day</title>
      <dc:creator>Alex Mercer</dc:creator>
      <pubDate>Fri, 20 Nov 2026 04:50:16 +0000</pubDate>
      <link>https://dev.to/alex_mercer_321994/3-quick-python-one-liners-that-save-me-time-every-day-26d8</link>
      <guid>https://dev.to/alex_mercer_321994/3-quick-python-one-liners-that-save-me-time-every-day-26d8</guid>
      <description>&lt;p&gt;When writing automation scripts or quick data-processing utilities in Python, keeping code clean and readable makes a huge difference. Here are three simple Python tricks I use almost daily to avoid writing unnecessary boilerplate loops.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Merging Two Dictionaries Cleanly (Python 3.9+)
&lt;/h3&gt;

&lt;p&gt;Instead of using &lt;code&gt;.update()&lt;/code&gt; or verbose loops, you can merge dictionaries in a single expression using the &lt;code&gt;|&lt;/code&gt; operator:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;default_headers = {"Accept": "text/html", "DNT": "1"}
custom_headers = {"User-Agent": "Mozilla/5.0", "DNT": "0"}

final_headers = default_headers | custom_headers
print(final_headers)
# Output: {'Accept': 'text/html', 'DNT': '0', 'User-Agent': 'Mozilla/5.0'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  2. Removing Duplicates While Preserving Order
&lt;/h3&gt;

&lt;p&gt;Converting a list to a &lt;code&gt;set()&lt;/code&gt; removes duplicates, but it scrambles the original order. Using &lt;code&gt;dict.fromkeys()&lt;/code&gt; keeps everything in exact sequence:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;urls = [
    "[https://example.com/page1](https://example.com/page1)",
    "[https://example.com/page2](https://example.com/page2)",
    "[https://example.com/page1](https://example.com/page1)",
    "[https://example.com/page3](https://example.com/page3)"
]

unique_urls = list(dict.fromkeys(urls))
print(unique_urls)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  3. Safe Dictionary Lookups with &lt;code&gt;.get()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To prevent &lt;code&gt;KeyError&lt;/code&gt; crashes when parsing messy JSON or API responses, always chain &lt;code&gt;.get()&lt;/code&gt; with a fallback default:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;api_response = {"status": 200, "data": {"items": 42}}

count = api_response.get("data", {}).get("items", 0)
print(count)  # 42
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;What are some of your favorite Python shortcuts for everyday scripting? Drop them in the comments!&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hey everyone! Excited to be here. Mostly working with Python automation and web dev tools.</title>
      <dc:creator>Alex Mercer</dc:creator>
      <pubDate>Thu, 19 Nov 2026 14:02:59 +0000</pubDate>
      <link>https://dev.to/alex_mercer_321994/hey-everyone-excited-to-be-here-mostly-working-with-python-automation-and-web-dev-tools-k1j</link>
      <guid>https://dev.to/alex_mercer_321994/hey-everyone-excited-to-be-here-mostly-working-with-python-automation-and-web-dev-tools-k1j</guid>
      <description></description>
    </item>
  </channel>
</rss>
